@@ -24,7 +24,7 @@ use std::{cmp, env, fs};
2424
2525use build_helper:: ci:: CiEnv ;
2626use build_helper:: exit;
27- use build_helper:: git:: { GitConfig , PathFreshness , check_path_modifications, output_result } ;
27+ use build_helper:: git:: { GitConfig , PathFreshness , check_path_modifications} ;
2828use serde:: Deserialize ;
2929#[ cfg( feature = "tracing" ) ]
3030use tracing:: { instrument, span} ;
@@ -47,9 +47,10 @@ use crate::core::config::{
4747} ;
4848use crate :: core:: download:: is_download_ci_available;
4949use crate :: utils:: channel;
50+ use crate :: utils:: exec:: command;
5051use crate :: utils:: execution_context:: ExecutionContext ;
5152use crate :: utils:: helpers:: exe;
52- use crate :: { Command , GitInfo , OnceLock , TargetSelection , check_ci_llvm, helpers, output , t} ;
53+ use crate :: { GitInfo , OnceLock , TargetSelection , check_ci_llvm, helpers, t} ;
5354
5455/// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
5556/// This means they can be modified and changes to these paths should never trigger a compiler build
@@ -445,7 +446,7 @@ impl Config {
445446 // has already been (kinda-cross-)compiled to Windows land, we require a normal Windows path.
446447 cmd. arg ( "rev-parse" ) . arg ( "--show-cdup" ) ;
447448 // Discard stderr because we expect this to fail when building from a tarball.
448- let output = cmd. run_capture_stdout_exec_ctx ( & config) ;
449+ let output = cmd. allow_failure ( ) . run_capture_stdout_exec_ctx ( & config) ;
449450 if output. is_success ( ) {
450451 let git_root_relative = output. stdout ( ) ;
451452 // We need to canonicalize this path to make sure it uses backslashes instead of forward slashes,
@@ -749,7 +750,12 @@ impl Config {
749750 } ;
750751
751752 config. initial_sysroot = t ! ( PathBuf :: from_str(
752- output( Command :: new( & config. initial_rustc) . args( [ "--print" , "sysroot" ] ) ) . trim( )
753+ command( & config. initial_rustc)
754+ . args( [ "--print" , "sysroot" ] )
755+ . run_always( )
756+ . run_capture_stdout_exec_ctx( & config)
757+ . stdout( )
758+ . trim( )
753759 ) ) ;
754760
755761 config. initial_cargo_clippy = cargo_clippy;
@@ -1062,7 +1068,7 @@ impl Config {
10621068
10631069 let mut git = helpers:: git ( Some ( & self . src ) ) ;
10641070 git. arg ( "show" ) . arg ( format ! ( "{commit}:{}" , file. to_str( ) . unwrap( ) ) ) ;
1065- output ( git. as_command_mut ( ) )
1071+ git. allow_failure ( ) . run_capture_stdout_exec_ctx ( self ) . stdout ( )
10661072 }
10671073
10681074 /// Bootstrap embeds a version number into the name of shared libraries it uploads in CI.
@@ -1333,16 +1339,20 @@ impl Config {
13331339 } ;
13341340
13351341 // Determine commit checked out in submodule.
1336- let checked_out_hash = output ( submodule_git ( ) . args ( [ "rev-parse" , "HEAD" ] ) . as_command_mut ( ) ) ;
1342+ let checked_out_hash = submodule_git ( )
1343+ . allow_failure ( )
1344+ . args ( [ "rev-parse" , "HEAD" ] )
1345+ . run_capture_stdout_exec_ctx ( self )
1346+ . stdout ( ) ;
13371347 let checked_out_hash = checked_out_hash. trim_end ( ) ;
13381348 // Determine commit that the submodule *should* have.
1339- let recorded = output (
1340- helpers :: git ( Some ( & self . src ) )
1341- . run_always ( )
1342- . args ( [ "ls-tree" , "HEAD" ] )
1343- . arg ( relative_path)
1344- . as_command_mut ( ) ,
1345- ) ;
1349+ let recorded = helpers :: git ( Some ( & self . src ) )
1350+ . allow_failure ( )
1351+ . run_always ( )
1352+ . args ( [ "ls-tree" , "HEAD" ] )
1353+ . arg ( relative_path)
1354+ . run_capture_stdout_exec_ctx ( self )
1355+ . stdout ( ) ;
13461356
13471357 let actual_hash = recorded
13481358 . split_whitespace ( )
@@ -1366,20 +1376,18 @@ impl Config {
13661376 let update = |progress : bool | {
13671377 // Git is buggy and will try to fetch submodules from the tracking branch for *this* repository,
13681378 // even though that has no relation to the upstream for the submodule.
1369- let current_branch = output_result (
1370- helpers:: git ( Some ( & self . src ) )
1371- . allow_failure ( )
1372- . run_always ( )
1373- . args ( [ "symbolic-ref" , "--short" , "HEAD" ] )
1374- . as_command_mut ( ) ,
1375- )
1376- . map ( |b| b. trim ( ) . to_owned ( ) ) ;
1379+ let current_branch = helpers:: git ( Some ( & self . src ) )
1380+ . allow_failure ( )
1381+ . run_always ( )
1382+ . args ( [ "symbolic-ref" , "--short" , "HEAD" ] )
1383+ . run_capture_exec_ctx ( self ) ;
13771384
13781385 let mut git = helpers:: git ( Some ( & self . src ) ) . allow_failure ( ) ;
13791386 git. run_always ( ) ;
1380- if let Ok ( branch ) = current_branch {
1387+ if current_branch . is_success ( ) {
13811388 // If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
13821389 // This syntax isn't accepted by `branch.{branch}`. Strip it.
1390+ let branch = current_branch. stdout ( ) ;
13831391 let branch = branch. strip_prefix ( "heads/" ) . unwrap_or ( & branch) ;
13841392 git. arg ( "-c" ) . arg ( format ! ( "branch.{branch}.remote=origin" ) ) ;
13851393 }
@@ -1425,7 +1433,8 @@ impl Config {
14251433 return ;
14261434 }
14271435
1428- let stage0_output = output ( Command :: new ( program_path) . arg ( "--version" ) ) ;
1436+ let stage0_output =
1437+ command ( program_path) . arg ( "--version" ) . run_capture_stdout_exec_ctx ( self ) . stdout ( ) ;
14291438 let mut stage0_output = stage0_output. lines ( ) . next ( ) . unwrap ( ) . split ( ' ' ) ;
14301439
14311440 let stage0_name = stage0_output. next ( ) . unwrap ( ) ;
0 commit comments