Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/process"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
backend |
std/process/native |
process.dodo |
error |
std/platform/error |
process.dodo |
io |
std/io |
process.dodo |
mem |
core/mem |
process.dodo |
native |
std/platform/native |
process.dodo |
FOREVER
Constant · Source
pub const FOREVER: u64 = 18446744073709551615
Stdio
Enum · Source
pub enum Stdio {
Inherit, Piped, Null
}
ExitKind
Enum · Source
pub enum ExitKind {
Exited, Signalled, Cancelled
}
ExitStatus
Struct · Source
pub struct ExitStatus {
pub kind: ExitKind
// Exit code on ordinary exit, native signal on Unix signal termination.
pub code: i32
}
ExitStatus.success
Function · Source
pub fn success(&self) -> bool
Output
Struct · Source
pub struct Output {
pub status: ExitStatus
pub stdout_len: usize
pub stderr_len: usize
}
CollectError
Struct · Source
pub struct CollectError {
pub cause: error.Error
pub stdout_len: usize
pub stderr_len: usize
}
Options
Struct · Source
pub struct Options {
pub stdin: Stdio
pub stdout: Stdio
pub stderr: Stdio
pub inherit_environment: bool
// Linux only. Direct executable selection is the default. PATH lookup
// explicitly observes the parent's PATH; no shell interpretation occurs.
pub search_path: bool
}
Options.new
Function · Source
pub fn new() -> Options
Options.capture
Function · Source
pub fn capture() -> Options
Child
Struct · Source
A Child uniquely owns the process and untaken pipes. Dropping an unfinished Child closes pipes, forcibly terminates, and reaps it. wait never drains pipes; use collect for captured output. A taken pipe has independent ownership.
pub struct Child {
// Private implementation fields omitted.
}
Child.wait
Function · Source
pub fn wait(&mut self) -> ExitStatus!error.Error
Child.wait_timeout
Function · Source
Timeout preserves a live child. Cancellation is explicit and recorded.
pub fn wait_timeout(&mut self, timeout_ms: u64) -> ExitStatus!error.Error
Child.try_wait
Function · Source
pub fn try_wait(&mut self) -> Option<ExitStatus>!error.Error
Child.terminate
Function · Source
pub fn terminate(&mut self) -> void!error.Error
Child.cancel
Function · Source
pub fn cancel(&mut self) -> void!error.Error
Child.take_stdin
Function · Source
pub fn take_stdin(&mut self) -> Option<Pipe>
Child.take_stdout
Function · Source
pub fn take_stdout(&mut self) -> Option<Pipe>
Child.take_stderr
Function · Source
pub fn take_stderr(&mut self) -> Option<Pipe>
Child.collect
Function · Source
Both streams are drained fairly, including outputs larger than pipe capacity. Buffers are explicit per-stream limits. Failure preserves each initialized prefix, closes pipes, kills and reaps the child. Stdin closes before collection, so interactive input must be written/taken beforehand.
pub fn collect(&mut self, stdout: &mut[u8], stderr: &mut[u8], timeout_ms: u64) -> Output!CollectError
spawn
Function · Source
Executable and all list entries use native code units. Arguments exclude argv[0], which is the executable. Spawn copies/consumes OS arguments before returning, so the child retains no caller borrows. Directory is optional.
pub fn spawn(executable: &native.NativeString, arguments: &native.NativeList,
environment: &native.NativeList, directory: Option<&native.NativeString>, options: &Options) -> Child!error.Error
Pipe
Struct · Source
Taken child pipes implement std/io; writes suppress only the writing thread’s generated SIGPIPE so a closed reader becomes a recoverable error.
pub struct Pipe {
// Private implementation fields omitted.
}
Pipe.read
Function · Source
pub fn read(&mut self, output: &mut[u8]) -> usize!io.Error
Pipe.write
Function · Source
pub fn write(&mut self, input: &[u8]) -> usize!io.Error
Pipe.close
Function · Source
pub fn close(&mut self) -> void!error.Error
into_status
Function · Source
Consume a collection report while transferring its non-Copy exit status.
pub fn into_status(output: Output) -> ExitStatus
CommandStorage
Struct · Source
Owns bounded native copies of the executable, directory and individual args. Defaults: inherited environment/streams/current directory, direct executable selection, no shell. args exclude argv[0]. Set options for spawn customization.
pub struct CommandStorage {
// Private implementation fields omitted.
}
CommandStorage.new
Function · Source
pub fn new() -> CommandStorage
Command
Struct · Source
pub struct Command {
pub options: Options
// Private implementation fields omitted.
}
Command.new
Function · Source
pub fn new(executable: &str, storage: &mut CommandStorage) -> Command!error.Error from(storage)
Command.arg
Function · Source
pub fn arg(&mut self, value: &str) -> void!error.Error
Command.clear_args
Function · Source
pub fn clear_args(&mut self)
Command.current_dir
Function · Source
pub fn current_dir(&mut self, path: &str) -> void!error.Error
Command.spawn_with_environment
Function · Source
Optional full-native child environment; selected by inherit_environment=false.
pub fn spawn_with_environment(&self, environment: &native.NativeList) -> Child!error.Error
Command.spawn
Function · Source
pub fn spawn(&self) -> Child!error.Error
Command.output
Function · Source
Overrides streams with null stdin and piped stdout/stderr. Other options are retained; inherit_environment=false selects an empty environment. Timeout starts at collection, AFTER synchronous spawn, and covers draining both pipes and waiting for this child. Failure retains prefixes and kills/ reaps the child. Cleanup time can exceed the budget; descendants are not killed.
pub fn output(&self, stdout: &mut[u8], stderr: &mut[u8], timeout_ms: u64) -> Output!CollectError