Struct Output
pub struct Output { pub status: ExitStatus, pub stdout: Vec<u8>, pub stderr: Vec<u8> }
The output of a finished process.
This is returned in a Result by either the output method of a
Command, or the wait_with_output method of a Child
process.
Fields
status: ExitStatusThe status (exit code) of the process.
stdout: Vec<u8>The data that the process wrote to stdout.
stderr: Vec<u8>The data that the process wrote to stderr.
Implementations
impl Output
fn exit_ok(self) -> Result<Self, ExitStatusError>Returns an error if a nonzero exit status was received.
If the
Commandexited successfully,selfis returned.This is equivalent to calling
exit_okonOutput.status.Note that this will throw away the
Output::stderrfield in the error case. If the child process outputs useful informantion to stderr, you can:- Use
cmd.stderr(Stdio::inherit())to forward the stderr child process to the parent's stderr, usually printing it to console where the user can see it. This is usually correct for command-line applications. - Capture
stderrusing a custom error type. This is usually correct for libraries.
Examples
# #- Use
Trait Implementations
impl Clone for Output
fn clone(&self) -> Self
impl Debug for Output
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
impl Eq for Output
fn assert_fields_are_eq(&self)
impl PartialEq for Output
fn eq(&self, other: &Self) -> bool
impl StructuralPartialEq for Output
Auto Trait Implementations
impl Freeze for Output
impl RefUnwindSafe for Output
impl Send for Output
impl Sync for Output
impl Unpin for Output
impl UnsafeUnpin for Output
impl UnwindSafe for Output
Blanket Implementations
impl<T> Any for Output
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Output
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Output
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Output
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Output
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Output
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Output
impl<T> ToOwned for Output
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Output
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Output
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Output
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>