@@ -21,7 +21,6 @@ use std::cell::{Cell, RefCell};
21
21
use std:: collections:: { BTreeSet , HashMap , HashSet } ;
22
22
use std:: fmt:: Display ;
23
23
use std:: path:: { Path , PathBuf } ;
24
- use std:: process:: Command ;
25
24
use std:: sync:: OnceLock ;
26
25
use std:: time:: SystemTime ;
27
26
use std:: { env, fs, io, str} ;
@@ -39,7 +38,7 @@ use crate::core::builder::Kind;
39
38
use crate :: core:: config:: { DryRun , LldMode , LlvmLibunwind , TargetSelection , flags} ;
40
39
use crate :: utils:: exec:: { BehaviorOnFailure , BootstrapCommand , CommandOutput , OutputMode , command} ;
41
40
use 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,
43
42
} ;
44
43
45
44
mod core;
@@ -376,10 +375,13 @@ impl Build {
376
375
let in_tree_llvm_info = config. in_tree_llvm_info . clone ( ) ;
377
376
let in_tree_gcc_info = config. in_tree_gcc_info . clone ( ) ;
378
377
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 ( ) ;
383
385
384
386
let initial_target_dir = Path :: new ( & initial_target_libdir)
385
387
. parent ( )
@@ -479,8 +481,11 @@ impl Build {
479
481
480
482
// If local-rust is the same major.minor as the current version, then force a
481
483
// 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 ( & build)
488
+ . stdout ( ) ;
484
489
let local_release = local_version_verbose
485
490
. lines ( )
486
491
. filter_map ( |x| x. strip_prefix ( "release:" ) )
@@ -941,9 +946,14 @@ impl Build {
941
946
fn rustc_snapshot_sysroot ( & self ) -> & Path {
942
947
static SYSROOT_CACHE : OnceLock < PathBuf > = OnceLock :: new ( ) ;
943
948
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 ( )
947
957
} )
948
958
}
949
959
0 commit comments