Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Union

StdIo

Public Union
std.process.SpawnOptions.StdIo
pub const StdIo = union(enum)

Behavior of the child process's standard input, output, and error streams.

Fields

inherit: inherit

Inherit the corresponding stream from the parent process.

file: File

Pass an already open file from the parent to the child.

Nonblocking mode will be kept in the child process if present. This is likely not supported by the child process. For example:

  • Zig's std.Io.File.stdout() assumes blocking mode
  • Rust explicity documents that nonblocking stdio may cause panics
  • C++ standard streams do not support nonblocking file descriptors
ignore: ignore

Pass a null stream to the child process by opening "/dev/null" on POSIX and "NUL" on Windows.

pipe: pipe

Create a new 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.

close: close

Spawn the child process with the corresponding stream missing. This will likely result in the child encountering EBADF if it tries to use stdin, stdout, or stderr, or if only one stream is closed, it will result in them getting mixed up. Generally, this option is for advanced use cases only.

File

process.zig:417
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
    pub const StdIo = union(enum) {
        /// Inherit the corresponding stream from the parent process.
        inherit,
        /// Pass an already open file from the parent to the child.
        ///
        /// Nonblocking mode will be kept in the child process if present. This is
        /// likely not supported by the child process. For example:
        /// - Zig's std.Io.File.stdout() assumes blocking mode
        /// - Rust explicity documents that nonblocking stdio may cause panics
        /// - C++ standard streams do not support nonblocking file descriptors
        file: File,
        /// Pass a null stream to the child process by opening "/dev/null" on POSIX
        /// and "NUL" on Windows.
        ignore,
        /// Create a new 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,
        /// Spawn the child process with the corresponding stream missing. This
        /// will likely result in the child encountering EBADF if it tries to use
        /// stdin, stdout, or stderr, or if only one stream is closed, it will
        /// result in them getting mixed up. Generally, this option is for advanced
        /// use cases only.
        close,
    }