From 8a1bdc17f6a50b682d43dd848cd39c903b50ad15 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 5 Apr 2021 19:46:16 -0500 Subject: [PATCH] fix: Provide consisten spawn failure message --- src/cmd.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmd.rs b/src/cmd.rs index ab0bc03..2a8d39e 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -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()))