about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-08 23:33:27 +0200
committerGitHub <noreply@github.com>2024-05-08 23:33:27 +0200
commit18639db87c2200cfcf51dc5f30e3b7d1cfe8e9f3 (patch)
tree7bd8cbb87f2076827e72dad976bdad7e3b556ab4 /src/bootstrap
parent294ac1b57d3f277855e3caac16ae92af10b6e772 (diff)
parentc7003f57ea863f1ecafe821b99e1fe5b5bc60fee (diff)
downloadrust-18639db87c2200cfcf51dc5f30e3b7d1cfe8e9f3.tar.gz
rust-18639db87c2200cfcf51dc5f30e3b7d1cfe8e9f3.zip
Rollup merge of #124903 - Skepfyr:rustc-wrapper, r=clubby789
Ignore empty RUSTC_WRAPPER in bootstrap

This change ignores the RUSTC_WRAPPER_REAL environment variable if it's set to the empty string. This matches cargo behaviour and allows users to easily shadow a globally set RUSTC_WRAPPER (which they might have set for non-rustc projects).

I hit this because I have RUSTC_WRAPPER set to `sccache` in my fish universal env vars, and I can only shadow those locally with an empty string, I can't unset it entirely.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/bin/rustc.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs
index 4b182a7a693..d2274199177 100644
--- a/src/bootstrap/src/bin/rustc.rs
+++ b/src/bootstrap/src/bin/rustc.rs
@@ -91,12 +91,13 @@ fn main() {
         rustc_real
     };
 
-    let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER_REAL") {
-        let mut cmd = Command::new(wrapper);
-        cmd.arg(rustc_driver);
-        cmd
-    } else {
-        Command::new(rustc_driver)
+    let mut cmd = match env::var_os("RUSTC_WRAPPER_REAL") {
+        Some(wrapper) if !wrapper.is_empty() => {
+            let mut cmd = Command::new(wrapper);
+            cmd.arg(rustc_driver);
+            cmd
+        }
+        _ => Command::new(rustc_driver),
     };
     cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());