From 37e06133d48cb0975338a6a1c6cac0a3b6fb86f0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 1 Sep 2024 12:48:33 +0200 Subject: [PATCH] apply RUSTC_WRAPPER when querying rustc version --- protobuf/build.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/protobuf/build.rs b/protobuf/build.rs index ba76c5659..3494f0753 100644 --- a/protobuf/build.rs +++ b/protobuf/build.rs @@ -19,8 +19,15 @@ fn version_is_nightly(version: &str) -> bool { fn cfg_rust_version() { let rustc = env::var("RUSTC").expect("RUSTC unset"); + let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) { + let mut cmd = process::Command::new(wrapper); + cmd.arg(rustc); + cmd + } else { + process::Command::new(rustc) + }; - let mut child = process::Command::new(rustc) + let mut child = cmd .args(&["--version"]) .stdin(process::Stdio::null()) .stdout(process::Stdio::piped())