Skip to content

Commit f10a198

Browse files
rbtcollinsdjc
authored andcommitted
Make common::self_update async
1 parent 1fe7153 commit f10a198

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/cli/common.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ pub(crate) fn update_all_channels(
310310
};
311311

312312
if do_self_update {
313-
self_update(show_channel_updates)
313+
utils::run_future(self_update(show_channel_updates))
314314
} else {
315315
show_channel_updates()
316316
}
@@ -350,7 +350,8 @@ pub(crate) fn self_update_permitted(explicit: bool) -> Result<SelfUpdatePermissi
350350
}
351351
}
352352

353-
pub(crate) fn self_update<F>(before_restart: F) -> Result<utils::ExitCode>
353+
/// Performs all of a self-update: check policy, download, apply and exit.
354+
pub(crate) async fn self_update<F>(before_restart: F) -> Result<utils::ExitCode>
354355
where
355356
F: FnOnce() -> Result<utils::ExitCode>,
356357
{
@@ -363,7 +364,7 @@ where
363364
SelfUpdatePermission::Permit => {}
364365
}
365366

366-
let setup_path = utils::run_future(self_update::prepare_update())?;
367+
let setup_path = self_update::prepare_update().await?;
367368

368369
before_restart()?;
369370

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ fn update(cfg: &mut Cfg, opts: UpdateOpts) -> Result<utils::ExitCode> {
860860
}
861861
}
862862
if self_update {
863-
common::self_update(|| Ok(utils::ExitCode(0)))?;
863+
utils::run_future(common::self_update(|| Ok(utils::ExitCode(0))))?;
864864
}
865865
} else {
866866
common::update_all_channels(cfg, self_update, opts.force)?;

0 commit comments

Comments
 (0)