Skip to content

Commit 53c4961

Browse files
committed
fix: properly fail if --get_paths cmd fails
1 parent b1feb93 commit 53c4961

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/git.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ pub fn get_paths_from_cmd(paths_cmd: &str) -> Result<Vec<AbsPath>> {
162162
.output()
163163
.context("failed to run provided paths_cmd")?;
164164

165+
ensure!(
166+
output.status.success(),
167+
format!("Failed to run provided paths_cmd: '{}'", paths_cmd)
168+
);
169+
165170
let files = std::str::from_utf8(&output.stdout).context("failed to parse paths_cmd output")?;
166171
let files = files
167172
.lines()
@@ -331,6 +336,12 @@ mod tests {
331336
Ok(())
332337
}
333338

339+
#[test]
340+
fn invalid_get_paths_from_cmd_fails() -> () {
341+
assert!(get_paths_from_cmd("asoidjfoaisdjf").is_err());
342+
assert!(get_paths_from_cmd("false").is_err());
343+
}
344+
334345
#[test]
335346
fn merge_base_with() -> Result<()> {
336347
let git = GitCheckout::new()?;

0 commit comments

Comments
 (0)