Skip to content

Commit 1b5e989

Browse files
authored
Merge pull request #201 from djc/exec-error
Bail at the end of exec with --no-bail if errors occurred
2 parents dd6806b + 4435297 commit 1b5e989

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

cargo-workspaces/src/exec.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ impl Exec {
4646
.map(|x| Glob::new(&x))
4747
.map_or::<StdResult<_, GlobsetError>, _>(Ok(None), |x| Ok(x.ok()))?;
4848

49+
let mut errored = false;
4950
for p in &visited {
5051
let (pkg, _) = names.get(p).expect(INTERNAL_ERR);
5152

@@ -65,12 +66,23 @@ impl Exec {
6566
.current_dir(dir)
6667
.status()?;
6768

68-
if !self.no_bail && !status.success() {
69-
return Err(Error::Bail);
69+
if !status.success() {
70+
match self.no_bail {
71+
true => errored = true,
72+
false => return Err(Error::Bail),
73+
}
7074
}
7175
}
7276

73-
info!("success", "ok");
74-
Ok(())
77+
match errored {
78+
true => {
79+
info!("failed", "error(s) occurred");
80+
Err(Error::Bail)
81+
}
82+
false => {
83+
info!("success", "ok");
84+
Ok(())
85+
}
86+
}
7587
}
7688
}

0 commit comments

Comments
 (0)