Skip to content

Commit

Permalink
Merge pull request #115 from epage/assert
Browse files Browse the repository at this point in the history
fix: Provide consisten spawn failure message
  • Loading branch information
epage authored Apr 6, 2021
2 parents 454648d + 8a1bdc1 commit 76d7f58
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,12 @@ impl<'c> OutputOkExt for &'c mut Command {

impl<'c> OutputAssertExt for &'c mut Command {
fn assert(self) -> Assert {
let output = self.output().unwrap();
let output = match self.output() {
Ok(output) => output,
Err(err) => {
panic!("Failed to spawn {:?}: {}", self, err);
}
};
let assert = Assert::new(output).append_context("command", format!("{:?}", self.cmd));
if let Some(stdin) = self.stdin.as_ref() {
assert.append_context("stdin", DebugBuffer::new(stdin.clone()))
Expand Down

0 comments on commit 76d7f58

Please sign in to comment.