Skip to content

Commit 09b81de

Browse files
committed
fix(cargo-codspeed): throw an error when a bench process fails
1 parent 7fd573e commit 09b81de

File tree

1 file changed

+11
-1
lines changed
  • crates/cargo-codspeed/src

1 file changed

+11
-1
lines changed

crates/cargo-codspeed/src/run.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,17 @@ pub fn run_benches(
7272
.status_with_color("Running", bench_name, Color::Yellow)?;
7373
std::process::Command::new(bench)
7474
.status()
75-
.map_err(|_| anyhow!("failed to execute the benchmark process"))?;
75+
.map_err(|_| anyhow!("failed to execute the benchmark process"))
76+
.and_then(|status| {
77+
if status.success() {
78+
Ok(())
79+
} else {
80+
Err(anyhow!(
81+
"failed to execute the benchmark process, exit code: {}",
82+
status.code().unwrap_or(1)
83+
))
84+
}
85+
})?;
7686
ws.config().shell().status_with_color(
7787
"Done",
7888
format!("running {}", bench_name),

0 commit comments

Comments
 (0)