@@ -21,7 +21,6 @@ use std::cell::{Cell, RefCell};
2121use std:: collections:: { BTreeSet , HashMap , HashSet } ;
2222use std:: fmt:: Display ;
2323use std:: path:: { Path , PathBuf } ;
24- use std:: process:: Command ;
2524use std:: sync:: OnceLock ;
2625use std:: time:: SystemTime ;
2726use std:: { env, fs, io, str} ;
@@ -39,7 +38,7 @@ use crate::core::builder::Kind;
3938use crate :: core:: config:: { DryRun , LldMode , LlvmLibunwind , TargetSelection , flags} ;
4039use crate :: utils:: exec:: { BehaviorOnFailure , BootstrapCommand , CommandOutput , OutputMode , command} ;
4140use crate :: utils:: helpers:: {
42- self , dir_is_empty, exe, libdir, output , set_file_times, split_debuginfo, symlink_dir,
41+ self , dir_is_empty, exe, libdir, set_file_times, split_debuginfo, symlink_dir,
4342} ;
4443
4544mod core;
@@ -376,10 +375,13 @@ impl Build {
376375 let in_tree_llvm_info = config. in_tree_llvm_info . clone ( ) ;
377376 let in_tree_gcc_info = config. in_tree_gcc_info . clone ( ) ;
378377
379- let initial_target_libdir =
380- output ( Command :: new ( & config. initial_rustc ) . args ( [ "--print" , "target-libdir" ] ) )
381- . trim ( )
382- . to_owned ( ) ;
378+ let initial_target_libdir = command ( & config. initial_rustc )
379+ . run_always ( )
380+ . args ( [ "--print" , "target-libdir" ] )
381+ . run_capture_stdout ( & config)
382+ . stdout ( )
383+ . trim ( )
384+ . to_owned ( ) ;
383385
384386 let initial_target_dir = Path :: new ( & initial_target_libdir)
385387 . parent ( )
@@ -479,8 +481,11 @@ impl Build {
479481
480482 // If local-rust is the same major.minor as the current version, then force a
481483 // local-rebuild
482- let local_version_verbose =
483- output ( Command :: new ( & build. initial_rustc ) . arg ( "--version" ) . arg ( "--verbose" ) ) ;
484+ let local_version_verbose = command ( & build. initial_rustc )
485+ . run_always ( )
486+ . args ( [ "--version" , "--verbose" ] )
487+ . run_capture_stdout ( & build)
488+ . stdout ( ) ;
484489 let local_release = local_version_verbose
485490 . lines ( )
486491 . filter_map ( |x| x. strip_prefix ( "release:" ) )
@@ -941,9 +946,14 @@ impl Build {
941946 fn rustc_snapshot_sysroot ( & self ) -> & Path {
942947 static SYSROOT_CACHE : OnceLock < PathBuf > = OnceLock :: new ( ) ;
943948 SYSROOT_CACHE . get_or_init ( || {
944- let mut rustc = Command :: new ( & self . initial_rustc ) ;
945- rustc. args ( [ "--print" , "sysroot" ] ) ;
946- output ( & mut rustc) . trim ( ) . into ( )
949+ command ( & self . initial_rustc )
950+ . run_always ( )
951+ . args ( [ "--print" , "sysroot" ] )
952+ . run_capture_stdout ( self )
953+ . stdout ( )
954+ . trim ( )
955+ . to_owned ( )
956+ . into ( )
947957 } )
948958 }
949959
0 commit comments