[][src]Struct assert_cmd::cmd::OutputError

pub struct OutputError { /* fields omitted */ }

Command error.

Generally produced by OutputOkExt.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let err = Command::new("a-command")
    .args(&["--will-fail"])
    .unwrap_err();

Methods

impl OutputError[src]

pub fn new(output: Output) -> Self[src]

Convert Output into an Error.

pub fn with_cause<E>(cause: E) -> Self where
    E: Error + Send + Sync + 'static, 
[src]

For errors that happen in creating a Output.

pub fn set_cmd(self, cmd: String) -> Self[src]

Add the command line for additional context.

pub fn set_stdin(self, stdin: Vec<u8>) -> Self[src]

Add the stdin for additional context.

pub fn as_output(&self) -> Option<&Output>[src]

Access the contained Output.

Examples

use assert_cmd::prelude::*;

use std::process::Command;

let err = Command::new("a-command")
    .args(&["--will-fail"])
    .unwrap_err();
let output = err
    .as_output()
    .unwrap();
assert_eq!(Some(42), output.status.code());

Trait Implementations

impl Debug for OutputError[src]

impl Display for OutputError[src]

impl Error for OutputError[src]

fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0
[src]

The lower-level source of this error, if any. Read more

Auto Trait Implementations

impl Send for OutputError

impl Sync for OutputError

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.