process.wit

 1interface process {
 2    use common.{env-vars};
 3
 4    /// A command.
 5    record command {
 6        /// The command to execute.
 7        command: string,
 8        /// The arguments to pass to the command.
 9        args: list<string>,
10        /// The environment variables to set for the command.
11        env: env-vars,
12    }
13
14    /// The output of a finished process.
15    record output {
16        /// The status (exit code) of the process.
17        ///
18        /// On Unix, this will be `None` if the process was terminated by a signal.
19        status: option<s32>,
20        /// The data that the process wrote to stdout.
21        stdout: list<u8>,
22        /// The data that the process wrote to stderr.
23        stderr: list<u8>,
24    }
25
26    /// Executes the given command as a child process, waiting for it to finish
27    /// and collecting all of its output.
28    run-command: func(command: command) -> result<output, string>;
29}