Skip to content

Commit 21c0737

Browse files
rbtcollinsdjc
authored andcommitted
Make update_from_dist async
1 parent 051fbb1 commit 21c0737

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/dist/dist.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ pub(crate) fn valid_profile_names() -> String {
703703
//
704704
// Returns the manifest's hash if anything changed.
705705
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all, fields(profile=format!("{profile:?}"), prefix=prefix.path().to_string_lossy().to_string())))]
706-
pub(crate) fn update_from_dist(
706+
pub(crate) async fn update_from_dist(
707707
download: DownloadCfg<'_>,
708708
update_hash: Option<&Path>,
709709
toolchain: &ToolchainDesc,
@@ -724,7 +724,7 @@ pub(crate) fn update_from_dist(
724724
std::fs::remove_file(update_hash.unwrap())?;
725725
}
726726

727-
let res = utils::run_future(update_from_dist_(
727+
let res = update_from_dist_(
728728
download,
729729
update_hash,
730730
toolchain,
@@ -735,7 +735,8 @@ pub(crate) fn update_from_dist(
735735
old_date,
736736
components,
737737
targets,
738-
));
738+
)
739+
.await;
739740

740741
// Don't leave behind an empty / broken installation directory
741742
if res.is_err() && fresh_install {

src/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a> InstallMethod<'a> {
136136
..
137137
} => {
138138
let prefix = &InstallPrefix::from(path.to_owned());
139-
let maybe_new_hash = dist::update_from_dist(
139+
let maybe_new_hash = utils::run_future(dist::update_from_dist(
140140
*dl_cfg,
141141
update_hash.as_deref(),
142142
desc,
@@ -147,7 +147,7 @@ impl<'a> InstallMethod<'a> {
147147
old_date_version.as_ref().map(|dv| dv.0.as_str()),
148148
components,
149149
targets,
150-
)?;
150+
))?;
151151

152152
if let Some(hash) = maybe_new_hash {
153153
if let Some(hash_file) = update_hash {

0 commit comments

Comments
 (0)