Struct assert_cmd::OutputError [−][src]
pub struct OutputError { /* fields omitted */ }
Command
error.
Examples
use assert_cmd::prelude::*; use std::process::Command; let err = Command::main_binary() .unwrap() .env("exit", "42") .unwrap_err();
Methods
impl OutputError
[src]
impl OutputError
pub fn new(output: Output) -> Self
[src]
pub fn new(output: Output) -> Self
Convert std::process::Output
into a Fail
.
pub fn with_cause<E>(cause: E) -> Self where
E: Into<Error>,
[src]
pub fn with_cause<E>(cause: E) -> Self where
E: Into<Error>,
For errors that happen in creating a std::process::Output
.
pub fn set_cmd(self, cmd: String) -> Self
[src]
pub fn set_cmd(self, cmd: String) -> Self
Add the command line for additional context.
pub fn set_stdin(self, stdin: Vec<u8>) -> Self
[src]
pub fn set_stdin(self, stdin: Vec<u8>) -> Self
Add the stdin
for additional context.
pub fn as_output(&self) -> Option<&Output>
[src]
pub fn as_output(&self) -> Option<&Output>
Access the contained std::process::Output
.
Examples
use assert_cmd::prelude::*; use std::process::Command; let err = Command::main_binary() .unwrap() .env("exit", "42") .unwrap_err(); let output = err .as_output() .unwrap(); assert_eq!(Some(42), output.status.code());
Trait Implementations
impl Fail for OutputError
[src]
impl Fail for OutputError
fn cause(&self) -> Option<&Fail>
[src]
fn cause(&self) -> Option<&Fail>
Returns a reference to the underlying cause of this failure, if it is an error that wraps other errors. Read more
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn backtrace(&self) -> Option<&Backtrace>
Returns a reference to the Backtrace
carried by this failure, if it carries one. Read more
fn context<D>(self, context: D) -> Context<D> where
D: Display + Send + Sync + 'static,
[src]
fn context<D>(self, context: D) -> Context<D> where
D: Display + Send + Sync + 'static,
Provides context for this failure. Read more
fn compat(self) -> Compat<Self>
[src]
fn compat(self) -> Compat<Self>
Wraps this failure in a compatibility wrapper that implements std::error::Error
. Read more
fn causes(&self) -> Causes
[src]
fn causes(&self) -> Causes
Returns a iterator over the causes of this Fail
with itself as the first item and the root_cause
as the final item. Read more
fn root_cause(&self) -> &(Fail + 'static)
[src]
fn root_cause(&self) -> &(Fail + 'static)
Returns the "root cause" of this Fail
- the last value in the cause chain which does not return an underlying cause
. Read more
impl Debug for OutputError
[src]
impl Debug for OutputError
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for OutputError
[src]
impl Display for OutputError
Auto Trait Implementations
impl Send for OutputError
impl Send for OutputError
impl Sync for OutputError
impl Sync for OutputError