Skip to content

Commit 48cf99e

Browse files
committed
respect RUSTUP_TOOLCHAIN env var
Signed-off-by: Pierre Fenoll <[email protected]>
1 parent 7e78539 commit 48cf99e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,18 @@ pub fn version() -> Result<Version> {
199199
/// like the git short hash and build date.
200200
pub fn version_meta() -> Result<VersionMeta> {
201201
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
202-
let cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) {
202+
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) {
203203
let mut cmd = Command::new(wrapper);
204204
cmd.arg(rustc);
205205
cmd
206206
} else {
207207
Command::new(rustc)
208208
};
209209

210+
if let Some(toolchain) = env::var_os("RUSTUP_TOOLCHAIN") {
211+
cmd.env("RUSTUP_TOOLCHAIN", toolchain);
212+
}
213+
210214
VersionMeta::for_command(cmd)
211215
}
212216

0 commit comments

Comments
 (0)