[−][src]Enum subprocess::Redirection
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
Do nothing with the stream.
The stream is typically inherited from the parent. The field
in Popen
corresponding to the stream will be None
.
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.
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)
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
.
Like File
, but the file is specified as Rc
.
This allows the same file to be used in multiple redirections.
Methods
impl Redirection
[src]
pub fn try_clone(&self) -> IoResult<Redirection>
[src]
Clone the underlying Redirection
, or return an error.
Can fail in File
variant.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Redirection
impl !Send for Redirection
impl !Sync for Redirection
impl Unpin for Redirection
impl UnwindSafe for Redirection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,