File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,19 @@ impl<'a> Toolchain<'a> {
423
423
} ;
424
424
let mut cmd = Command :: new ( path) ;
425
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
+ }
426
439
Ok ( cmd)
427
440
}
428
441
You can’t perform that action at this time.
0 commit comments