diff --git a/src/git.rs b/src/git.rs index 66daec0..0c21751 100644 --- a/src/git.rs +++ b/src/git.rs @@ -162,6 +162,11 @@ pub fn get_paths_from_cmd(paths_cmd: &str) -> Result> { .output() .context("failed to run provided paths_cmd")?; + ensure!( + output.status.success(), + format!("Failed to run provided paths_cmd: '{}'", paths_cmd) + ); + let files = std::str::from_utf8(&output.stdout).context("failed to parse paths_cmd output")?; let files = files .lines() @@ -331,6 +336,12 @@ mod tests { Ok(()) } + #[test] + fn invalid_get_paths_from_cmd_fails() -> () { + assert!(get_paths_from_cmd("asoidjfoaisdjf").is_err()); + assert!(get_paths_from_cmd("false").is_err()); + } + #[test] fn merge_base_with() -> Result<()> { let git = GitCheckout::new()?;