From 44e5c53a31d7c12deb33740b4291acc5acafa4c7 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 4 Jan 2024 13:45:50 +0200 Subject: [PATCH] fix: if a command fails, fail the CI run Oops. Signed-off-by: Lars Wirzenius --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 5133da6..12c0785 100644 --- a/src/main.rs +++ b/src/main.rs @@ -234,7 +234,10 @@ fn runcmd(log: &mut LogFile, argv: &[&str], cwd: &Path) -> Result<(), NativeErro error .to_writer(std::io::stdout()) .map_err(|e| NativeError::WriteResponse(error.clone(), e))?; - return Ok(()); + return Err(NativeError::CommandFailed( + exit.code().unwrap(), + argv.iter().map(|s| s.to_string()).collect(), + )); } Ok(()) } @@ -499,4 +502,7 @@ enum NativeError { #[error("failed to run command {0:?}")] Command(Vec, #[source] std::io::Error), + + #[error("command failed with exit code {0}: {1:?}")] + CommandFailed(i32, Vec), }