diff options
| author | Zuhaitz <zuhaitz.zechhub@gmail.com> | 2026-01-31 17:22:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-31 17:22:17 +0000 |
| commit | 962d659c61212b1a23acfe56dda7cb92b721feda (patch) | |
| tree | ba1637d3885213095b312f81a477c33b1ebca6aa /examples/process | |
| parent | e521ee7d175393ef37579ebd61ccb7e8d56a397f (diff) | |
| parent | 91ed9fdd65e09bd6cd32e44dd07c390f2cf79c22 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'examples/process')
| -rw-r--r-- | examples/process/exec.zc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/process/exec.zc b/examples/process/exec.zc new file mode 100644 index 0000000..712a356 --- /dev/null +++ b/examples/process/exec.zc @@ -0,0 +1,20 @@ + +import "std/process.zc"; +import "std/string.zc"; + +fn main() { + "Executing 'ls -la' using std/process..."; + + let output = Command::new("ls") + .arg("-l") + .arg("-a") + .output(); + + if output.exit_code == 0 { + "--- Output ---"; + output.stdout.print(); + "--------------"; + } else { + !"Command failed with exit code: {output.exit_code}"; + } +} |
