Skip to content

Commit

Permalink
workaround cargo bugs on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Dec 9, 2023
1 parent 118b6e4 commit 03c1975
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! never get replaced.

use std::env;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::{Child, Command};
use std::time::Instant;

Expand Down Expand Up @@ -85,7 +85,10 @@ fn main() {
} else {
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
if args[0] == env::current_exe().expect("couldn't get path to rustc shim") {
// Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually.
let current_exe = env::current_exe().expect("couldn't get path to rustc shim");
let arg0 = exe(args[0].to_str().expect("only utf8 paths are supported"), &target_name);
if Path::new(&arg0) == current_exe {
args.remove(0);
}
rustc_real
Expand Down

0 comments on commit 03c1975

Please sign in to comment.