about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Rickard <jack.rickard@outlook.com>2024-05-08 19:42:25 +0100
committerJack Rickard <jack.rickard@outlook.com>2024-05-08 19:42:25 +0100
commitc7003f57ea863f1ecafe821b99e1fe5b5bc60fee (patch)
tree948d2f81d35473fd8e3dff3d86bfb23c74351c3d
parentce652dbb9a1e62e7ba91e5b5ce6063a7e0b3c448 (diff)
downloadrust-c7003f57ea863f1ecafe821b99e1fe5b5bc60fee.tar.gz
rust-c7003f57ea863f1ecafe821b99e1fe5b5bc60fee.zip
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).
-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());