diff options
Diffstat (limited to 'examples/process/exec.zc')
| -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}"; + } +} |
