mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Replace dep jobserver
with jobslot
(#355)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
56bafc8c9b
commit
32c3154abb
4 changed files with 19 additions and 8 deletions
14
Cargo.lock
generated
14
Cargo.lock
generated
|
@ -95,7 +95,7 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
"home",
|
"home",
|
||||||
"itertools",
|
"itertools",
|
||||||
"jobserver",
|
"jobslot",
|
||||||
"log",
|
"log",
|
||||||
"miette",
|
"miette",
|
||||||
"normalize-path",
|
"normalize-path",
|
||||||
|
@ -942,6 +942,18 @@ dependencies = [
|
||||||
"libc",
|
"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]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.59"
|
version = "0.3.59"
|
||||||
|
|
|
@ -25,7 +25,7 @@ futures-util = { version = "0.3.23", default-features = false, features = ["std"
|
||||||
generic-array = "0.14.6"
|
generic-array = "0.14.6"
|
||||||
home = "0.5.3"
|
home = "0.5.3"
|
||||||
itertools = "0.10.3"
|
itertools = "0.10.3"
|
||||||
jobserver = "0.1.24"
|
jobslot = { version = "0.2.1", features = ["tokio"] }
|
||||||
log = { version = "0.4.17", features = ["std"] }
|
log = { version = "0.4.17", features = ["std"] }
|
||||||
miette = "5.3.0"
|
miette = "5.3.0"
|
||||||
normalize-path = { version = "0.1.0", path = "../normalize-path" }
|
normalize-path = { version = "0.1.0", path = "../normalize-path" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{num::NonZeroUsize, sync::Arc, thread::available_parallelism};
|
use std::{num::NonZeroUsize, sync::Arc, thread::available_parallelism};
|
||||||
|
|
||||||
use jobserver::Client;
|
use jobslot::Client;
|
||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
|
|
||||||
use crate::errors::BinstallError;
|
use crate::errors::BinstallError;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{path::PathBuf, process, sync::Arc};
|
use std::{path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
use cargo_toml::Package;
|
use cargo_toml::Package;
|
||||||
use compact_str::CompactString;
|
use compact_str::CompactString;
|
||||||
|
@ -151,10 +151,8 @@ async fn install_from_source(
|
||||||
"Running `cargo install {} --version {} --target {target}`",
|
"Running `cargo install {} --version {} --target {target}`",
|
||||||
package.name, package.version
|
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")
|
cmd.arg("install")
|
||||||
.arg(package.name)
|
.arg(package.name)
|
||||||
|
@ -173,7 +171,8 @@ async fn install_from_source(
|
||||||
|
|
||||||
let command_string = format!("{:?}", cmd);
|
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());
|
debug!("Spawned command pid={:?}", child.id());
|
||||||
|
|
||||||
let status = child.wait().await?;
|
let status = child.wait().await?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue