File tree 1 file changed +14
-4
lines changed 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1077,17 +1077,27 @@ fn cargo(
1077
1077
script_args : & [ OsString ] ,
1078
1078
run_quietly : bool ,
1079
1079
) -> MainResult < Command > {
1080
- let mut cmd = Command :: new ( "cargo" ) ;
1080
+ // Always specify a toolchain to avoid being affected by rust-version(.toml) files:
1081
+ let toolchain_version = toolchain_version. unwrap_or ( "stable" ) ;
1082
+
1083
+ let mut cmd = if std:: env:: var_os ( "RUSTUP_TOOLCHAIN" ) . is_some ( ) {
1084
+ // Running inside rustup which can't always call into rustup proxies, so explicitly call
1085
+ // rustup
1086
+ let mut cmd = Command :: new ( "rustup" ) ;
1087
+ cmd. args ( [ "run" , toolchain_version, "cargo" ] ) ;
1088
+ cmd
1089
+ } else {
1090
+ let mut cmd = Command :: new ( "cargo" ) ;
1091
+ cmd. arg ( format ! ( "+{}" , toolchain_version) ) ;
1092
+ cmd
1093
+ } ;
1081
1094
1082
1095
// Set tracing on if not set
1083
1096
if std:: env:: var_os ( "RUST_BACKTRACE" ) . is_none ( ) {
1084
1097
cmd. env ( "RUST_BACKTRACE" , "1" ) ;
1085
1098
info ! ( "setting RUST_BACKTRACE=1 for this cargo run" ) ;
1086
1099
}
1087
1100
1088
- // Always specify a toolchain to avoid being affected by rust-version(.toml) files:
1089
- cmd. arg ( format ! ( "+{}" , toolchain_version. unwrap_or( "stable" ) ) ) ;
1090
-
1091
1101
cmd. arg ( cmd_name) ;
1092
1102
1093
1103
if cmd_name == "run" && run_quietly {
You can’t perform that action at this time.
0 commit comments