Skip to content

Commit

Permalink
Add RUSTC_WRAPPER support to build script
Browse files Browse the repository at this point in the history
(cherry picked from commit 8dba4a0)
  • Loading branch information
nathaniel-bennett committed Aug 16, 2024
1 parent 67c4300 commit 570d892
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,17 @@ fn rustc_minor_nightly() -> (u32, bool) {
};
}

let rustc = otry!(env::var_os("RUSTC"));
let output = Command::new(rustc)
let rustc = env::var_os("RUSTC").expect("Failed to get rustc version: missing RUSTC env");
let mut cmd = match env::var_os("RUSTC_WRAPPER").as_ref() {
Some(wrapper) if !wrapper.is_empty() => {
let mut cmd = Command::new(wrapper);
cmd.arg(rustc);
cmd
}
_ => Command::new(rustc),
};

let output = cmd
.arg("--version")
.output()
.ok()
Expand Down

0 comments on commit 570d892

Please sign in to comment.