spawn

public func spawn(String) -> Int32

Runs command through the system shell and returns its exit code.

Wraps libc::system, which on POSIX runs /bin/sh -c <command> and returns a packed status word; this function shifts off the signal/coredump bits and returns just the exit code (0–255 in normal cases). The child's stdout and stderr are inherited from the parent process — they go straight to the terminal. For captured output, use captureOutput.

Examples

let code = spawn("ls -la"); if code != 0 { print("ls failed"); }

Defined in lang/std/os/proc.ks