pub enum Redirection {
None,
Pipe,
Merge,
File(File),
Null,
}Expand description
Variants§
None
Do nothing with the stream.
The stream is typically inherited from the parent. The corresponding pipe field in
Job will be None.
Pipe
Redirect the stream to a pipe.
This variant requests that a stream be redirected to a unidirectional pipe. One end of the pipe is passed to the child process and configured as one of its standard streams, and the other end is available to the parent for communicating with the child.
Merge
Merge the stream to the other output stream.
This variant is only valid when configuring redirection of standard output and
standard error. Using Redirection::Merge for stderr requests the child’s stderr
to refer to the same underlying file as the child’s stdout (which may or may not
itself be redirected), equivalent to the 2>&1 operator of the Bourne
shell. Analogously, using Redirection::Merge for stdout is equivalent to 1>&2
in the shell.
Specifying Redirection::Merge for stdin or specifying it for both stdout and
stderr is invalid and will cause an error.
File(File)
Redirect the stream to the specified open File.
This does not create a pipe, it simply spawns the child so that the specified stream sees that file. The child can read from or write to the provided file on its own, without any intervention by the parent.
Null
Redirect the stream to the null device (/dev/null on Unix, nul on Windows).
This is equivalent to Redirection::File with a null device file, but more
convenient and portable.