Skip to content

Commit 7bffe77

Browse files
committed
respect RUSTC_WRAPPER env var
1 parent 599b9e9 commit 7bffe77

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,16 @@ pub fn version() -> Result<Version> {
198198
/// Returns the `rustc` SemVer version and additional metadata
199199
/// like the git short hash and build date.
200200
pub fn version_meta() -> Result<VersionMeta> {
201-
let cmd = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
201+
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
202+
let cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
203+
let mut cmd = Command::new(wrapper);
204+
cmd.arg(rustc);
205+
cmd
206+
} else {
207+
Command::new(rustc)
208+
};
202209

203-
VersionMeta::for_command(Command::new(cmd))
210+
VersionMeta::for_command(cmd)
204211
}
205212

206213
/// Parses a "rustc -vV" output string and returns

0 commit comments

Comments
 (0)