Skip to content

Commit

Permalink
Don't use RUSTC_WRAPPER if it's empty. (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode authored Mar 20, 2023
1 parent ef3493b commit 56b8bc9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
let rustc = var("RUSTC").unwrap();
let target = var("TARGET").unwrap();

let mut cmd = if let Ok(wrapper) = var("RUSTC_WRAPPER") {
// Use `RUSTC_WRAPPER` if it's set, unless it's set to an empty string,
// as documented [here].
// [here]: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-reads
let wrapper = var("RUSTC_WRAPPER")
.ok()
.and_then(|w| if w.is_empty() { None } else { Some(w) });

let mut cmd = if let Some(wrapper) = wrapper {
let mut cmd = std::process::Command::new(wrapper);
// The wrapper's first argument is supposed to be the path to rustc.
cmd.arg(rustc);
Expand Down

0 comments on commit 56b8bc9

Please sign in to comment.