#[non_exhaustive]pub enum Redirection {
Capture,
Inherit,
Null,
File(Arc<File>),
}Expand description
Where a child process’s stdout or stderr goes.
The stderr default is Capture (every error variant
carries captured stderr, so that’s almost always what you want). The
stdout default is also Capture for Cmd::run —
the bytes end up in RunOutput::stdout.
For Cmd::spawn, stdout is always piped internally
so callers can take_stdout or
read through the handle; a non-Capture stdout redirection here is not
currently supported on the spawn path.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Capture
Capture into memory (default). Available in
RunOutput on success and in error variants on
failure.
Inherit
Inherit the parent’s file descriptor. Useful when the child should
prompt the user (e.g., ssh password prompts) or when the user
should see live progress.
Null
Discard (/dev/null). The corresponding captured field will be
empty.
File(Arc<File>)
Redirect to a file. The Arc lets Cmd stay Clone
— the underlying file is try_clone()d per spawn so every stage /
retry gets its own file descriptor. Construct via
Redirection::file to avoid wrapping the Arc by
hand.
Implementations§
Source§impl Redirection
impl Redirection
Sourcepub fn file(f: File) -> Redirection
pub fn file(f: File) -> Redirection
Build a File variant from a std::fs::File, wrapping
it in Arc internally. Prefer this over constructing the variant
directly.
Trait Implementations§
Source§impl Clone for Redirection
impl Clone for Redirection
Source§fn clone(&self) -> Redirection
fn clone(&self) -> Redirection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more