std.process - ZZ
Run and spawn external processes. Results cross as [status, stdout, stderr] inside Result; spawned children are opaque "process" handles.
import std.processPurpose
Section titled “Purpose”std.process runs commands (run, run_with_env), spawns non-blocking children (spawn + wait), queries pid, and terminates with exit. Env entries must be K=V — check-time errors name the bad entry.
Quickstart
Section titled “Quickstart”import std.process
match process.run("ls", ["-la"]) { .ok(out) => println("status {out[0]}"), .err(e) => println(e),}match process.run_with_env("make", ["test"], ["RUST_BACKTRACE=1"]) { .ok(out) => println(out[1]), .err(e) => println(e),}
// Non-blocking spawnfunc main() -> Result<int, str> { child := process.spawn("ls", ["-la"])? triple := process.wait(child)? // [status, stdout, stderr] println(process.pid()) return .ok(0)}Production patterns
Section titled “Production patterns”import std.process
func run_capture(cmd: str, args: [str]) -> Result<str, str> { return match process.run(cmd, args) { .ok(out) => { if out[0] != 0 { return .err(out[2]) // stderr on failure } .ok(out[1]) // stdout } .err(e) => .err(e), }}API reference
Section titled “API reference”6 entries. Signatures come from the compiler’s own FuncSig table, so they match the runtime exactly; descriptions come from the module guide.
See also
Section titled “See also”std.env— Environment variables and the surrounding host environment.std.args— argv access and the flag parser: booleans, integers, strings and subcommands.std.log— Log levels, sinks and spans for structured logging.std.sys— Infallible machine information: OS, CPU, memory and uptime.std.path— Pure lexical path manipulation: join, split, extension and normalisation.std.cell— Shared mutable slots for lock-free hand-off between green threads.
Full index: API reference · Standard library