Skip to content

Commit f0dd5b7

Browse files
author
Ed Page
committed
fix(assert): Be explicit about spawn failure
Users had to infer the reason for the panic based on the location. Instead, we should tell them what failed so they can more quickly get up and going on fixing it. Fixes assert-rs#109
1 parent b4d4beb commit f0dd5b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/assert.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ impl OutputAssertExt for process::Output {
5757

5858
impl<'c> OutputAssertExt for &'c mut process::Command {
5959
fn assert(self) -> Assert {
60-
let output = self.output().unwrap();
60+
let output = match self.output() {
61+
Ok(output) => output,
62+
Err(err) => {
63+
panic!("Failed to spawn {:?}: {}", self, err);
64+
}
65+
};
6166
Assert::new(output).append_context("command", format!("{:?}", self))
6267
}
6368
}

0 commit comments

Comments
 (0)