From c7003f57ea863f1ecafe821b99e1fe5b5bc60fee Mon Sep 17 00:00:00 2001 From: Jack Rickard Date: Wed, 8 May 2024 19:42:25 +0100 Subject: [PATCH] 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). --- src/bootstrap/src/bin/rustc.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index 4b182a7a693dd..d227419917767 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());