We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4514d36 commit f9ed6fcCopy full SHA for f9ed6fc
src/toolchain.rs
@@ -423,6 +423,19 @@ impl<'a> Toolchain<'a> {
423
};
424
let mut cmd = Command::new(path);
425
self.set_env(&mut cmd);
426
+
427
+ // If we're running cargo and the `CARGO` environment variable is set
428
+ // to a rustup proxy then change `CARGO` to be the real cargo binary,
429
+ // but only if we know the absolute path to cargo.
430
+ // This works around an issue with old versions of cargo not updating
431
+ // the environment variable itself.
432
+ if Path::new(&binary).file_stem() == Some("cargo".as_ref()) && path.is_absolute() {
433
+ if let Some(cargo) = self.cfg.process.var_os("CARGO") {
434
+ if fs::read_link(&cargo).is_ok_and(|p| p.file_stem() == Some("rustup".as_ref())) {
435
+ cmd.env("CARGO", path);
436
+ }
437
438
439
Ok(cmd)
440
}
441
0 commit comments