processProcess execution.
Run external commands and manage child processes.
import std::process;
fn main() {
// Run a command and capture output
let output = process.run("ls -la");
println(output);
// Spawn a long-running process
let child = process.start("sleep 10");
let status = child.wait();
println(status);
}
runRun a shell command synchronously and return its stdout as a string.
Blocks until the command completes. The command is executed via the system shell.
let output = process.run("echo hello");
assert_eq(string_trim(output), "hello");
run_argsRun a command with explicit arguments.
args is a space-separated argument string. arg_count is the
number of arguments.
startStart a child process without blocking.
Returns a Child handle that can be waited on or killed.
Note: This function is called start rather than spawn because
spawn is a reserved keyword in Hew (used for spawning actors).
let child = process.start("sleep 5");
// ... do other work ...
let status = child.wait();
ChildA handle to a running child process.
Created by process.start(cmd). Use wait() to block until
the process exits, or kill() to terminate it.
ChildMethodsMethods available on a Child process.