struct Command
pub struct Command
Describes a process to start: the program — a path, or a name looked up on PATH —, its
arguments, its working directory (the parent's where null), variables set over the parent's
environment, and its three standard streams.
Fields
pub program: string
pub args: string[] = []
pub cwd: ?string = null
pub env: (string, string)[] = []
pub stdin: Stdio = Stdio.Inherit
pub stdout: Stdio = Stdio.Inherit
pub stderr: Stdio = Stdio.Inherit
Methods
pub fn spawn(): Child throws IoError
Starts the process and returns it as a Child.
Errors
Throws IoError: NotFound for a program that is not there, PermissionDenied for one
that may not run — each with the program as the path —, and InvalidInput for a variable
name that is empty or holds =, or a NUL in an argument or a variable.
pub fn output(): Output throws [IoError, Cancelled]
Starts the child with its output and errors piped and nothing to read, reads both to their ends — concurrently, so a child that fills one pipe while the other is drained does not stall —, waits for its end, and returns all of it as Output.
Errors
Throws IoError when the child cannot be started or a pipe fails, and Cancelled when the waiting task is cancelled.
pub fn status(): ExitStatus throws [IoError, Cancelled]
Starts the child with the parent's streams, waits for its end and returns how it ended.
Errors
Throws IoError when the child cannot be started, and Cancelled when the waiting task is cancelled.