@@ -23,13 +23,13 @@ use crate::utils::utils;
2323use crate :: {
2424 dist:: notifications as dist_notifications, toolchain:: distributable:: DistributableToolchain ,
2525} ;
26- use crate :: { process, toolchain:: toolchain:: Toolchain } ;
26+ use crate :: { process:: Process , toolchain:: toolchain:: Toolchain } ;
2727use crate :: { Cfg , Notification } ;
2828
2929pub ( crate ) const WARN_COMPLETE_PROFILE : & str = "downloading with complete profile isn't recommended unless you are a developer of the rust language" ;
3030
3131pub ( crate ) fn confirm ( question : & str , default : bool ) -> Result < bool > {
32- write ! ( process ( ) . stdout( ) . lock( ) , "{question} " ) ?;
32+ write ! ( Process :: get ( ) . stdout( ) . lock( ) , "{question} " ) ?;
3333 let _ = std:: io:: stdout ( ) . flush ( ) ;
3434 let input = read_line ( ) ?;
3535
@@ -40,7 +40,7 @@ pub(crate) fn confirm(question: &str, default: bool) -> Result<bool> {
4040 _ => false ,
4141 } ;
4242
43- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
43+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
4444
4545 Ok ( r)
4646}
@@ -52,15 +52,15 @@ pub(crate) enum Confirm {
5252}
5353
5454pub ( crate ) fn confirm_advanced ( customized_install : bool ) -> Result < Confirm > {
55- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
55+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
5656 let first_option = match customized_install {
5757 true => "1) Proceed with selected options (default - just press enter)" ,
5858 false => "1) Proceed with standard installation (default - just press enter)" ,
5959 } ;
60- writeln ! ( process ( ) . stdout( ) . lock( ) , "{first_option}" ) ?;
61- writeln ! ( process ( ) . stdout( ) . lock( ) , "2) Customize installation" ) ?;
62- writeln ! ( process ( ) . stdout( ) . lock( ) , "3) Cancel installation" ) ?;
63- write ! ( process ( ) . stdout( ) . lock( ) , ">" ) ?;
60+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "{first_option}" ) ?;
61+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "2) Customize installation" ) ?;
62+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "3) Cancel installation" ) ?;
63+ write ! ( Process :: get ( ) . stdout( ) . lock( ) , ">" ) ?;
6464
6565 let _ = std:: io:: stdout ( ) . flush ( ) ;
6666 let input = read_line ( ) ?;
@@ -71,17 +71,17 @@ pub(crate) fn confirm_advanced(customized_install: bool) -> Result<Confirm> {
7171 _ => Confirm :: No ,
7272 } ;
7373
74- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
74+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
7575
7676 Ok ( r)
7777}
7878
7979pub ( crate ) fn question_str ( question : & str , default : & str ) -> Result < String > {
80- writeln ! ( process ( ) . stdout( ) . lock( ) , "{question} [{default}]" ) ?;
80+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "{question} [{default}]" ) ?;
8181 let _ = std:: io:: stdout ( ) . flush ( ) ;
8282 let input = read_line ( ) ?;
8383
84- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
84+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
8585
8686 if input. is_empty ( ) {
8787 Ok ( default. to_string ( ) )
@@ -92,12 +92,12 @@ pub(crate) fn question_str(question: &str, default: &str) -> Result<String> {
9292
9393pub ( crate ) fn question_bool ( question : & str , default : bool ) -> Result < bool > {
9494 let default_text = if default { "(Y/n)" } else { "(y/N)" } ;
95- writeln ! ( process ( ) . stdout( ) . lock( ) , "{question} {default_text}" ) ?;
95+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "{question} {default_text}" ) ?;
9696
9797 let _ = std:: io:: stdout ( ) . flush ( ) ;
9898 let input = read_line ( ) ?;
9999
100- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
100+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
101101
102102 if input. is_empty ( ) {
103103 Ok ( default)
@@ -111,7 +111,7 @@ pub(crate) fn question_bool(question: &str, default: bool) -> Result<bool> {
111111}
112112
113113pub ( crate ) fn read_line ( ) -> Result < String > {
114- let stdin = process ( ) . stdin ( ) ;
114+ let stdin = Process :: get ( ) . stdin ( ) ;
115115 let stdin = stdin. lock ( ) ;
116116 let mut lines = stdin. lines ( ) ;
117117 let lines = lines. next ( ) . transpose ( ) ?;
@@ -250,7 +250,7 @@ fn show_channel_updates(
250250 Ok ( ( pkg, banner, width, color, version, previous_version) )
251251 } ) ;
252252
253- let mut t = process ( ) . stdout ( ) . terminal ( ) ;
253+ let mut t = Process :: get ( ) . stdout ( ) . terminal ( ) ;
254254
255255 let data: Vec < _ > = data. collect :: < Result < _ > > ( ) ?;
256256 let max_width = data
@@ -291,7 +291,7 @@ pub(crate) fn update_all_channels(
291291
292292 let show_channel_updates = || {
293293 if !toolchains. is_empty ( ) {
294- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
294+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
295295
296296 let t = toolchains
297297 . into_iter ( )
@@ -371,7 +371,7 @@ where
371371}
372372
373373pub ( crate ) fn list_targets ( distributable : DistributableToolchain < ' _ > ) -> Result < utils:: ExitCode > {
374- let mut t = process ( ) . stdout ( ) . terminal ( ) ;
374+ let mut t = Process :: get ( ) . stdout ( ) . terminal ( ) ;
375375 let manifestation = distributable. get_manifestation ( ) ?;
376376 let config = manifestation. read_config ( ) ?. unwrap_or_default ( ) ;
377377 let manifest = distributable. get_manifest ( ) ?;
@@ -399,7 +399,7 @@ pub(crate) fn list_targets(distributable: DistributableToolchain<'_>) -> Result<
399399pub ( crate ) fn list_installed_targets (
400400 distributable : DistributableToolchain < ' _ > ,
401401) -> Result < utils:: ExitCode > {
402- let t = process ( ) . stdout ( ) ;
402+ let t = Process :: get ( ) . stdout ( ) ;
403403 let manifestation = distributable. get_manifestation ( ) ?;
404404 let config = manifestation. read_config ( ) ?. unwrap_or_default ( ) ;
405405 let manifest = distributable. get_manifest ( ) ?;
@@ -422,7 +422,7 @@ pub(crate) fn list_installed_targets(
422422pub ( crate ) fn list_components (
423423 distributable : DistributableToolchain < ' _ > ,
424424) -> Result < utils:: ExitCode > {
425- let mut t = process ( ) . stdout ( ) . terminal ( ) ;
425+ let mut t = Process :: get ( ) . stdout ( ) . terminal ( ) ;
426426
427427 let manifestation = distributable. get_manifestation ( ) ?;
428428 let config = manifestation. read_config ( ) ?. unwrap_or_default ( ) ;
@@ -443,7 +443,7 @@ pub(crate) fn list_components(
443443}
444444
445445pub ( crate ) fn list_installed_components ( distributable : DistributableToolchain < ' _ > ) -> Result < ( ) > {
446- let t = process ( ) . stdout ( ) ;
446+ let t = Process :: get ( ) . stdout ( ) ;
447447 for component in distributable. components ( ) ? {
448448 if component. installed {
449449 writeln ! ( t. lock( ) , "{}" , component. name) ?;
@@ -471,7 +471,7 @@ fn print_toolchain_path(
471471 String :: new ( )
472472 } ;
473473 writeln ! (
474- process ( ) . stdout( ) . lock( ) ,
474+ Process :: get ( ) . stdout( ) . lock( ) ,
475475 "{}{}{}{}" ,
476476 & toolchain,
477477 if_default,
@@ -489,7 +489,7 @@ pub(crate) fn list_toolchains(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCod
489489 . map ( Into :: into)
490490 . collect :: < Vec < _ > > ( ) ;
491491 if toolchains. is_empty ( ) {
492- writeln ! ( process ( ) . stdout( ) . lock( ) , "no installed toolchains" ) ?;
492+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "no installed toolchains" ) ?;
493493 } else {
494494 let def_toolchain_name = cfg. get_default ( ) ?. map ( |t| ( & t) . into ( ) ) ;
495495 let cwd = utils:: current_dir ( ) ?;
@@ -527,7 +527,7 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result<utils::ExitCode> {
527527 let overrides = cfg. settings_file . with ( |s| Ok ( s. overrides . clone ( ) ) ) ?;
528528
529529 if overrides. is_empty ( ) {
530- writeln ! ( process ( ) . stdout( ) . lock( ) , "no overrides" ) ?;
530+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "no overrides" ) ?;
531531 } else {
532532 let mut any_not_exist = false ;
533533 for ( k, v) in overrides {
@@ -536,15 +536,15 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result<utils::ExitCode> {
536536 any_not_exist = true ;
537537 }
538538 writeln ! (
539- process ( ) . stdout( ) . lock( ) ,
539+ Process :: get ( ) . stdout( ) . lock( ) ,
540540 "{:<40}\t {:<20}" ,
541541 utils:: format_path_for_display( & k)
542542 + if dir_exists { "" } else { " (not a directory)" } ,
543543 v
544544 ) ?
545545 }
546546 if any_not_exist {
547- writeln ! ( process ( ) . stdout( ) . lock( ) ) ?;
547+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) ) ?;
548548 info ! (
549549 "you may remove overrides for non-existent directories with
550550`rustup override unset --nonexistent`"
@@ -567,51 +567,51 @@ pub(crate) fn version() -> &'static str {
567567pub ( crate ) fn dump_testament ( ) -> Result < utils:: ExitCode > {
568568 use git_testament:: GitModification :: * ;
569569 writeln ! (
570- process ( ) . stdout( ) . lock( ) ,
570+ Process :: get ( ) . stdout( ) . lock( ) ,
571571 "Rustup version renders as: {}" ,
572572 version( )
573573 ) ?;
574574 writeln ! (
575- process ( ) . stdout( ) . lock( ) ,
575+ Process :: get ( ) . stdout( ) . lock( ) ,
576576 "Current crate version: {}" ,
577577 env!( "CARGO_PKG_VERSION" )
578578 ) ?;
579579 if TESTAMENT . branch_name . is_some ( ) {
580580 writeln ! (
581- process ( ) . stdout( ) . lock( ) ,
581+ Process :: get ( ) . stdout( ) . lock( ) ,
582582 "Built from branch: {}" ,
583583 TESTAMENT . branch_name. unwrap( )
584584 ) ?;
585585 } else {
586- writeln ! ( process ( ) . stdout( ) . lock( ) , "Branch information missing" ) ?;
586+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "Branch information missing" ) ?;
587587 }
588588 writeln ! (
589- process ( ) . stdout( ) . lock( ) ,
589+ Process :: get ( ) . stdout( ) . lock( ) ,
590590 "Commit info: {}" ,
591591 TESTAMENT . commit
592592 ) ?;
593593 if TESTAMENT . modifications . is_empty ( ) {
594- writeln ! ( process ( ) . stdout( ) . lock( ) , "Working tree is clean" ) ?;
594+ writeln ! ( Process :: get ( ) . stdout( ) . lock( ) , "Working tree is clean" ) ?;
595595 } else {
596596 for fmod in TESTAMENT . modifications {
597597 match fmod {
598598 Added ( f) => writeln ! (
599- process ( ) . stdout( ) . lock( ) ,
599+ Process :: get ( ) . stdout( ) . lock( ) ,
600600 "Added: {}" ,
601601 String :: from_utf8_lossy( f)
602602 ) ?,
603603 Removed ( f) => writeln ! (
604- process ( ) . stdout( ) . lock( ) ,
604+ Process :: get ( ) . stdout( ) . lock( ) ,
605605 "Removed: {}" ,
606606 String :: from_utf8_lossy( f)
607607 ) ?,
608608 Modified ( f) => writeln ! (
609- process ( ) . stdout( ) . lock( ) ,
609+ Process :: get ( ) . stdout( ) . lock( ) ,
610610 "Modified: {}" ,
611611 String :: from_utf8_lossy( f)
612612 ) ?,
613613 Untracked ( f) => writeln ! (
614- process ( ) . stdout( ) . lock( ) ,
614+ Process :: get ( ) . stdout( ) . lock( ) ,
615615 "Untracked: {}" ,
616616 String :: from_utf8_lossy( f)
617617 ) ?,
@@ -622,15 +622,15 @@ pub(crate) fn dump_testament() -> Result<utils::ExitCode> {
622622}
623623
624624fn show_backtrace ( ) -> bool {
625- if let Ok ( true ) = process ( ) . var ( "RUSTUP_NO_BACKTRACE" ) . map ( |s| s == "1" ) {
625+ if let Ok ( true ) = Process :: get ( ) . var ( "RUSTUP_NO_BACKTRACE" ) . map ( |s| s == "1" ) {
626626 return false ;
627627 }
628628
629- if let Ok ( true ) = process ( ) . var ( "RUST_BACKTRACE" ) . map ( |s| s == "1" ) {
629+ if let Ok ( true ) = Process :: get ( ) . var ( "RUST_BACKTRACE" ) . map ( |s| s == "1" ) {
630630 return true ;
631631 }
632632
633- for arg in process ( ) . args ( ) {
633+ for arg in Process :: get ( ) . args ( ) {
634634 if arg == "-v" || arg == "--verbose" {
635635 return true ;
636636 }
0 commit comments