Skip to content

Commit 1f583ca

Browse files
rbtcollinsdjc
authored andcommitted
Make toolchain_link async
1 parent 0e444e3 commit 1f583ca

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,9 @@ pub async fn main() -> Result<utils::ExitCode> {
626626
ToolchainSubcmd::List { verbose } => {
627627
handle_epipe(common::list_toolchains(cfg, verbose))
628628
}
629-
ToolchainSubcmd::Link { toolchain, path } => toolchain_link(cfg, &toolchain, &path),
629+
ToolchainSubcmd::Link { toolchain, path } => {
630+
toolchain_link(cfg, &toolchain, &path).await
631+
}
630632
ToolchainSubcmd::Uninstall { opts } => toolchain_remove(cfg, opts),
631633
},
632634
RustupSubcmd::Check => check_updates(cfg),
@@ -1245,7 +1247,11 @@ fn component_remove(
12451247
Ok(utils::ExitCode(0))
12461248
}
12471249

1248-
fn toolchain_link(cfg: &Cfg, dest: &CustomToolchainName, src: &Path) -> Result<utils::ExitCode> {
1250+
async fn toolchain_link(
1251+
cfg: &Cfg,
1252+
dest: &CustomToolchainName,
1253+
src: &Path,
1254+
) -> Result<utils::ExitCode> {
12491255
cfg.ensure_toolchains_dir()?;
12501256
let mut pathbuf = PathBuf::from(src);
12511257

@@ -1258,16 +1264,15 @@ fn toolchain_link(cfg: &Cfg, dest: &CustomToolchainName, src: &Path) -> Result<u
12581264
utils::assert_is_file(&pathbuf)?;
12591265

12601266
if true {
1261-
utils::run_future(
1262-
InstallMethod::Link {
1263-
src: &utils::to_absolute(src)?,
1264-
dest,
1265-
cfg,
1266-
}
1267-
.install(),
1268-
)?;
1267+
InstallMethod::Link {
1268+
src: &utils::to_absolute(src)?,
1269+
dest,
1270+
cfg,
1271+
}
1272+
.install()
1273+
.await?;
12691274
} else {
1270-
utils::run_future(InstallMethod::Copy { src, dest, cfg }.install())?;
1275+
InstallMethod::Copy { src, dest, cfg }.install().await?;
12711276
}
12721277

12731278
Ok(utils::ExitCode(0))

0 commit comments

Comments
 (0)