Skip to content

Commit 7a4cac5

Browse files
authored
Merge pull request #358 from dtolnay/workspacewrapper
Apply RUSTC_WORKSPACE_WRAPPER
2 parents 9f84a37 + 939db01 commit 7a4cac5

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
use std::str;
@@ -103,15 +104,15 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
103104
let out_dir = cargo_env_var("OUT_DIR");
104105
let probefile = Path::new("build").join("probe.rs");
105106

106-
// Make sure to pick up Cargo rustc configuration.
107-
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
108-
let mut cmd = Command::new(wrapper);
109-
// The wrapper's first argument is supposed to be the path to rustc.
110-
cmd.arg(rustc);
111-
cmd
112-
} else {
113-
Command::new(rustc)
114-
};
107+
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
108+
let rustc_workspace_wrapper =
109+
env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
110+
let mut rustc = rustc_wrapper
111+
.into_iter()
112+
.chain(rustc_workspace_wrapper)
113+
.chain(iter::once(rustc));
114+
let mut cmd = Command::new(rustc.next().unwrap());
115+
cmd.args(rustc);
115116

116117
if !rustc_bootstrap {
117118
cmd.env_remove("RUSTC_BOOTSTRAP");

0 commit comments

Comments
 (0)