From 556ed8a4ad7ee653bbbb0c02d0da596f9df3cbf3 Mon Sep 17 00:00:00 2001 From: Mark Ingram Date: Mon, 20 Mar 2023 12:44:10 +0000 Subject: [PATCH] Only use RUSTC_WRAPPER when non empty (#565) Co-authored-by: Mark Ingram --- build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 99dbf4059..c738a90f0 100644 --- a/build.rs +++ b/build.rs @@ -199,7 +199,11 @@ fn can_compile>(test: T) -> bool { let rustc = var("RUSTC").unwrap(); let target = var("TARGET").unwrap(); - let mut cmd = if let Ok(wrapper) = var("RUSTC_WRAPPER") { + let wrapper = var("RUSTC_WRAPPER") + .ok() + .and_then(|w| if w.is_empty() { None } else { Some(w) }); + + let mut cmd = if let Some(wrapper) = wrapper { let mut cmd = std::process::Command::new(wrapper); // The wrapper's first argument is supposed to be the path to rustc. cmd.arg(rustc);