@@ -532,32 +532,7 @@ pub(crate) async fn install(
532
532
}
533
533
534
534
let no_modify_path = opts. no_modify_path ;
535
- let install_res = move || async move {
536
- install_bins ( ) ?;
537
-
538
- #[ cfg( unix) ]
539
- do_write_env_files ( ) ?;
540
-
541
- if !opts. no_modify_path {
542
- #[ cfg( windows) ]
543
- do_add_to_programs ( ) ?;
544
- do_add_to_path ( ) ?;
545
- }
546
-
547
- // If RUSTUP_HOME is not set, make sure it exists
548
- if process ( ) . var_os ( "RUSTUP_HOME" ) . is_none ( ) {
549
- let home = utils:: home_dir ( )
550
- . map ( |p| p. join ( ".rustup" ) )
551
- . ok_or_else ( || anyhow:: anyhow!( "could not find home dir to put .rustup in" ) ) ?;
552
-
553
- fs:: create_dir_all ( home) . context ( "unable to create ~/.rustup" ) ?;
554
- }
555
-
556
- maybe_install_rust ( current_dir, verbose, quiet, opts) . await ?;
557
- Ok ( utils:: ExitCode ( 0 ) )
558
- } ;
559
-
560
- if let Err ( e) = install_res ( ) . await {
535
+ if let Err ( e) = maybe_install_rust ( current_dir, verbose, quiet, opts) . await {
561
536
report_error ( & e) ;
562
537
563
538
// On windows, where installation happens in a console
@@ -848,6 +823,26 @@ async fn maybe_install_rust(
848
823
quiet : bool ,
849
824
opts : InstallOpts < ' _ > ,
850
825
) -> Result < ( ) > {
826
+ install_bins ( ) ?;
827
+
828
+ #[ cfg( unix) ]
829
+ do_write_env_files ( ) ?;
830
+
831
+ if !opts. no_modify_path {
832
+ #[ cfg( windows) ]
833
+ do_add_to_programs ( ) ?;
834
+ do_add_to_path ( ) ?;
835
+ }
836
+
837
+ // If RUSTUP_HOME is not set, make sure it exists
838
+ if process ( ) . var_os ( "RUSTUP_HOME" ) . is_none ( ) {
839
+ let home = utils:: home_dir ( )
840
+ . map ( |p| p. join ( ".rustup" ) )
841
+ . ok_or_else ( || anyhow:: anyhow!( "could not find home dir to put .rustup in" ) ) ?;
842
+
843
+ fs:: create_dir_all ( home) . context ( "unable to create ~/.rustup" ) ?;
844
+ }
845
+
851
846
let mut cfg = common:: set_globals ( current_dir, verbose, quiet) ?;
852
847
853
848
let ( components, targets) = ( opts. components , opts. targets ) ;
0 commit comments