Skip to content

Commit 488d52f

Browse files
committed
Apply RUSTC_WORKSPACE_WRAPPER
1 parent ba33438 commit 488d52f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

build.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::env;
22
use std::ffi::OsString;
3+
use std::iter;
34
use std::path::Path;
45
use std::process::{self, Command, Stdio};
56

@@ -66,15 +67,15 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
6667
let out_dir = cargo_env_var("OUT_DIR");
6768
let probefile = Path::new("build").join("probe.rs");
6869

69-
// Make sure to pick up Cargo rustc configuration.
70-
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
71-
let mut cmd = Command::new(wrapper);
72-
// The wrapper's first argument is supposed to be the path to rustc.
73-
cmd.arg(rustc);
74-
cmd
75-
} else {
76-
Command::new(rustc)
77-
};
70+
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
71+
let rustc_workspace_wrapper =
72+
env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
73+
let mut rustc = rustc_wrapper
74+
.into_iter()
75+
.chain(rustc_workspace_wrapper)
76+
.chain(iter::once(rustc));
77+
let mut cmd = Command::new(rustc.next().unwrap());
78+
cmd.args(rustc);
7879

7980
if !rustc_bootstrap {
8081
cmd.env_remove("RUSTC_BOOTSTRAP");

0 commit comments

Comments
 (0)