diff --git a/Cargo.lock b/Cargo.lock index e993bae4..b9e7d200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,7 +95,7 @@ dependencies = [ "generic-array", "home", "itertools", - "jobserver", + "jobslot", "log", "miette", "normalize-path", @@ -942,6 +942,18 @@ dependencies = [ "libc", ] +[[package]] +name = "jobslot" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0478230fe7c53cb89765785904f3cd9a1fb95f7d3261c343fe3248627e6060" +dependencies = [ + "cfg-if", + "libc", + "scopeguard", + "tokio", +] + [[package]] name = "js-sys" version = "0.3.59" diff --git a/crates/lib/Cargo.toml b/crates/lib/Cargo.toml index 7a800d77..c65d40b2 100644 --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -25,7 +25,7 @@ futures-util = { version = "0.3.23", default-features = false, features = ["std" generic-array = "0.14.6" home = "0.5.3" itertools = "0.10.3" -jobserver = "0.1.24" +jobslot = { version = "0.2.1", features = ["tokio"] } log = { version = "0.4.17", features = ["std"] } miette = "5.3.0" normalize-path = { version = "0.1.0", path = "../normalize-path" } diff --git a/crates/lib/src/helpers/jobserver_client.rs b/crates/lib/src/helpers/jobserver_client.rs index acfbc6c5..ca65fcd4 100644 --- a/crates/lib/src/helpers/jobserver_client.rs +++ b/crates/lib/src/helpers/jobserver_client.rs @@ -1,6 +1,6 @@ use std::{num::NonZeroUsize, sync::Arc, thread::available_parallelism}; -use jobserver::Client; +use jobslot::Client; use tokio::sync::OnceCell; use crate::errors::BinstallError; diff --git a/crates/lib/src/ops/install.rs b/crates/lib/src/ops/install.rs index 6632c50b..582bbc42 100644 --- a/crates/lib/src/ops/install.rs +++ b/crates/lib/src/ops/install.rs @@ -1,4 +1,4 @@ -use std::{path::PathBuf, process, sync::Arc}; +use std::{path::PathBuf, sync::Arc}; use cargo_toml::Package; use compact_str::CompactString; @@ -151,10 +151,8 @@ async fn install_from_source( "Running `cargo install {} --version {} --target {target}`", package.name, package.version ); - let mut command = process::Command::new("cargo"); - jobserver_client.configure(&mut command); - let mut cmd = Command::from(command); + let mut cmd = Command::new("cargo"); cmd.arg("install") .arg(package.name) @@ -173,7 +171,8 @@ async fn install_from_source( let command_string = format!("{:?}", cmd); - let mut child = cmd.spawn()?; + let mut child = jobserver_client.configure_and_run(&mut cmd, |cmd| cmd.spawn())?; + debug!("Spawned command pid={:?}", child.id()); let status = child.wait().await?;