Skip to content

Commit

Permalink
Make maybe_install_rust async
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtcollins committed Jan 28, 2024
1 parent 072df71 commit c06eacb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pub(crate) async fn install(
}
}

let install_res: Result<utils::ExitCode> = (|| {
let install_res: Result<utils::ExitCode> = async {
install_bins()?;

#[cfg(unix)]
Expand All @@ -472,10 +472,12 @@ pub(crate) async fn install(
opts.targets,
verbose,
quiet,
)?;
)
.await?;

Ok(utils::ExitCode(0))
})();
}
.await;

if let Err(e) = install_res {
report_error(&e);
Expand Down Expand Up @@ -833,7 +835,7 @@ pub(crate) fn install_proxies() -> Result<()> {
Ok(())
}

fn maybe_install_rust(
async fn maybe_install_rust(
toolchain: Option<MaybeOfficialToolchainName>,
profile_str: &str,
default_host_triple: Option<&str>,
Expand Down Expand Up @@ -863,16 +865,19 @@ fn maybe_install_rust(
// - delete the partial install and start over
// For now, we error.
let mut toolchain = DistributableToolchain::new(&cfg, desc.clone())?;
utils::run_future(toolchain.update(components, targets, cfg.get_profile()?))?
toolchain
.update(components, targets, cfg.get_profile()?)
.await?
} else {
utils::run_future(DistributableToolchain::install(
DistributableToolchain::install(
&cfg,
desc,
components,
targets,
cfg.get_profile()?,
true,
))?
)
.await?
.0
};

Expand Down

0 comments on commit c06eacb

Please sign in to comment.