Skip to content

Commit

Permalink
fix: 🐛 Avoid spawning cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Jan 13, 2023
1 parent 2e111b3 commit 6788316
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ async fn install(args: InstallOpts) -> Result<()> {
}

// With a list of applications to install, install them all in parallel.
let (tx, mut rx) = mpsc::channel::<Result<Vec<String>, Error>>(32);
let installable_items = to_install.len();
let (tx, mut rx) = mpsc::channel::<Result<Vec<String>, Error>>(installable_items);
for app in to_install {
let tx = tx.clone();
tokio::spawn(async move {
Expand Down
20 changes: 10 additions & 10 deletions src/toolchain/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Installable for XtensaRust {
cmd!("/bin/bash", "-c", arguments)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;

download_file(
self.src_dist_url.clone(),
Expand All @@ -220,7 +220,7 @@ impl Installable for XtensaRust {
cmd!("/bin/bash", "-c", arguments)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
}
// Some platfroms like Windows are available in single bundle rust + src, because install
// script in dist is not available for the plaform. It's sufficient to extract the toolchain
Expand Down Expand Up @@ -262,7 +262,7 @@ impl Crate {
cmd!("cargo", "uninstall", extra_crate, "--quiet")
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
Ok(())
}
}
Expand All @@ -283,7 +283,7 @@ impl Installable for Crate {
cmd!("cargo", "install", &self.name, "--quiet")
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
}

Ok(vec![]) // No exports
Expand Down Expand Up @@ -317,7 +317,7 @@ impl RiscVTarget {
)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
Ok(())
}
}
Expand All @@ -336,7 +336,7 @@ impl Installable for RiscVTarget {
)
.into_inner()
.stderr(Stdio::null())
.spawn()?;
.output()?;
cmd!(
"rustup",
"target",
Expand All @@ -348,7 +348,7 @@ impl Installable for RiscVTarget {
)
.into_inner()
.stderr(Stdio::null())
.spawn()?;
.output()?;

Ok(vec![]) // No exports
}
Expand Down Expand Up @@ -457,7 +457,7 @@ async fn install_rustup(nightly_version: &str, host_triple: &HostTriple) -> Resu
)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
#[cfg(not(windows))]
cmd!(
"/bin/bash",
Expand All @@ -473,7 +473,7 @@ async fn install_rustup(nightly_version: &str, host_triple: &HostTriple) -> Resu
)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;

#[cfg(windows)]
let path = format!(
Expand Down Expand Up @@ -511,7 +511,7 @@ fn install_rust_nightly(version: &str) -> Result<(), Error> {
)
.into_inner()
.stdout(Stdio::null())
.spawn()?;
.output()?;
Ok(())
}

Expand Down

0 comments on commit 6788316

Please sign in to comment.