Skip to content

Commit

Permalink
Fail when build-sysroot fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nilehmann committed Jan 6, 2025
1 parent 50e349d commit 6f5a706
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
env,
ffi::OsStr,
path::{Path, PathBuf},
process::ExitStatus,
};

use anyhow::anyhow;
Expand Down Expand Up @@ -275,11 +276,31 @@ fn run_cargo<S: AsRef<OsStr>>(
}
}

child.wait()?;
check_status(child.wait()?)?;

Ok(artifacts)
}

fn check_status(st: ExitStatus) -> anyhow::Result<()> {
if st.success() {
return Ok(());
}
let err = match st.code() {
Some(code) => anyhow!("command exited with non-zero code: {code}"),
#[cfg(unix)]
None => {
use std::os::unix::process::ExitStatusExt;
match st.signal() {
Some(sig) => anyhow!("command was terminated by a signal: {sig}"),
None => anyhow!("command was terminated by a signal"),
}
}
#[cfg(not(unix))]
None => anyhow!(f, "command was terminated by a signal"),
};
Err(err)
}

fn display_command(cmd: &std::process::Command) {
for var in cmd.get_envs() {
if let Some(val) = var.1 {
Expand Down

0 comments on commit 6f5a706

Please sign in to comment.