mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
ChildProcess: document StdIo behaviors (#17553)
Add some basic documentation for the different ChildProcess.StdIo behaviors and the fields they affect.
This commit is contained in:
parent
1216050520
commit
d37182383d
1 changed files with 26 additions and 0 deletions
|
|
@ -31,10 +31,23 @@ pub const ChildProcess = struct {
|
|||
|
||||
allocator: mem.Allocator,
|
||||
|
||||
/// The writing end of the child process's standard input pipe.
|
||||
/// Usage requires `stdin_behavior == StdIo.Pipe`.
|
||||
/// Available after calling `spawn()`.
|
||||
stdin: ?File,
|
||||
|
||||
/// The reading end of the child process's standard output pipe.
|
||||
/// Usage requires `stdout_behavior == StdIo.Pipe`.
|
||||
/// Available after calling `spawn()`.
|
||||
stdout: ?File,
|
||||
|
||||
/// The reading end of the child process's standard error pipe.
|
||||
/// Usage requires `stderr_behavior == StdIo.Pipe`.
|
||||
/// Available after calling `spawn()`.
|
||||
stderr: ?File,
|
||||
|
||||
/// Terminated state of the child process.
|
||||
/// Available after calling `wait()`.
|
||||
term: ?(SpawnError!Term),
|
||||
|
||||
argv: []const []const u8,
|
||||
|
|
@ -159,10 +172,23 @@ pub const ChildProcess = struct {
|
|||
Unknown: u32,
|
||||
};
|
||||
|
||||
/// Behavior of the child process's standard input, output, and error
|
||||
/// streams.
|
||||
pub const StdIo = enum {
|
||||
/// Inherit the stream from the parent process.
|
||||
Inherit,
|
||||
|
||||
/// Pass a null stream to the child process.
|
||||
/// This is /dev/null on POSIX and NUL on Windows.
|
||||
Ignore,
|
||||
|
||||
/// Create a pipe for the stream.
|
||||
/// The corresponding field (`stdout`, `stderr`, or `stdin`)
|
||||
/// will be assigned a `File` object that can be used
|
||||
/// to read from or write to the pipe.
|
||||
Pipe,
|
||||
|
||||
/// Close the stream after the child process spawns.
|
||||
Close,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue