Enum subprocess::Redirection [−][src]
Expand description
Instruction what to do with a stream in the child process.
Redirection values are used for the stdin, stdout, and
stderr field of the PopenConfig struct. They tell
Popen::create how to set up the standard streams in the child
process and the corresponding fields of the Popen struct in the
parent.
Variants
Expand description
Do nothing with the stream.
The stream is typically inherited from the parent. The field
in Popen corresponding to the stream will be None.
Expand description
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.
The field with Popen corresponding to the stream will be
Some(file), File being the parent’s end of the pipe.
Expand description
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 PopenConfig::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
PopenConfig::stdout is equivalent to 1>&2 in the shell.
Specifying Redirection::Merge for PopenConfig::stdin or
specifying it for both stdout and stderr is invalid and
will cause Popen::create to return
Err(PopenError::LogicError).
The field in Popen corresponding to the stream will be
None.
File(File)Expand description
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.
The field in Popen corresponding to the stream will be
None.
Expand description
Like File, but the file is specified as Rc.
This allows the same file to be used in multiple redirections.
Implementations
impl Redirection[src]
impl Redirection[src]pub fn try_clone(&self) -> Result<Redirection>[src]
pub fn try_clone(&self) -> Result<Redirection>[src]Clone the underlying Redirection, or return an error.
Can fail in File variant.