Replace dep jobserver with jobslot (#355)

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-09-09 18:46:43 +10:00 committed by GitHub
parent 56bafc8c9b
commit 32c3154abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View file

@ -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" }

View file

@ -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;

View file

@ -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?;