Struct Output
struct Output { ... }
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: 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
impl Clone for Output
fn clone(self: &Self) -> Output
impl Debug for Output
fn fmt(self: &Self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for Output
impl Freeze for Output
impl PartialEq for Output
fn eq(self: &Self, other: &Output) -> bool
impl RefUnwindSafe for Output
impl Send for Output
impl StructuralPartialEq for Output
impl Sync for Output
impl Unpin for Output
impl UnwindSafe for Output
impl<T> Any for Output
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Output
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Output
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Output
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Output
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Output
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Output
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Output
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Output
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>