Skip to content

Commit c06eacb

Browse files
committed
Make maybe_install_rust async
1 parent 072df71 commit c06eacb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/cli/self_update.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ pub(crate) async fn install(
452452
}
453453
}
454454

455-
let install_res: Result<utils::ExitCode> = (|| {
455+
let install_res: Result<utils::ExitCode> = async {
456456
install_bins()?;
457457

458458
#[cfg(unix)]
@@ -472,10 +472,12 @@ pub(crate) async fn install(
472472
opts.targets,
473473
verbose,
474474
quiet,
475-
)?;
475+
)
476+
.await?;
476477

477478
Ok(utils::ExitCode(0))
478-
})();
479+
}
480+
.await;
479481

480482
if let Err(e) = install_res {
481483
report_error(&e);
@@ -833,7 +835,7 @@ pub(crate) fn install_proxies() -> Result<()> {
833835
Ok(())
834836
}
835837

836-
fn maybe_install_rust(
838+
async fn maybe_install_rust(
837839
toolchain: Option<MaybeOfficialToolchainName>,
838840
profile_str: &str,
839841
default_host_triple: Option<&str>,
@@ -863,16 +865,19 @@ fn maybe_install_rust(
863865
// - delete the partial install and start over
864866
// For now, we error.
865867
let mut toolchain = DistributableToolchain::new(&cfg, desc.clone())?;
866-
utils::run_future(toolchain.update(components, targets, cfg.get_profile()?))?
868+
toolchain
869+
.update(components, targets, cfg.get_profile()?)
870+
.await?
867871
} else {
868-
utils::run_future(DistributableToolchain::install(
872+
DistributableToolchain::install(
869873
&cfg,
870874
desc,
871875
components,
872876
targets,
873877
cfg.get_profile()?,
874878
true,
875-
))?
879+
)
880+
.await?
876881
.0
877882
};
878883

0 commit comments

Comments
 (0)