mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Pass -q
to cargo-install
if log_level
is set to off
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3d28549fd6
commit
b6a539735d
3 changed files with 14 additions and 4 deletions
|
@ -17,4 +17,5 @@ pub struct Options {
|
|||
pub manifest_path: Option<PathBuf>,
|
||||
pub cli_overrides: PkgOverride,
|
||||
pub desired_targets: DesiredTargets,
|
||||
pub quiet: bool,
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ pub async fn install(
|
|||
.ok_or_else(|| miette!("No viable targets found, try with `--targets`"))?;
|
||||
|
||||
if !opts.dry_run {
|
||||
install_from_source(package, target, jobserver_client)
|
||||
install_from_source(package, target, jobserver_client, opts.quiet)
|
||||
.await
|
||||
.map(|_| None)
|
||||
} else {
|
||||
|
@ -126,6 +126,7 @@ async fn install_from_source(
|
|||
package: Package<Meta>,
|
||||
target: &str,
|
||||
lazy_jobserver_client: LazyJobserverClient,
|
||||
quiet: bool,
|
||||
) -> Result<()> {
|
||||
let jobserver_client = lazy_jobserver_client.get().await?;
|
||||
|
||||
|
@ -136,13 +137,20 @@ async fn install_from_source(
|
|||
let mut command = process::Command::new("cargo");
|
||||
jobserver_client.configure(&mut command);
|
||||
|
||||
let mut child = Command::from(command)
|
||||
.arg("install")
|
||||
let mut cmd = Command::from(command);
|
||||
|
||||
cmd.arg("install")
|
||||
.arg(package.name)
|
||||
.arg("--version")
|
||||
.arg(package.version)
|
||||
.arg("--target")
|
||||
.arg(&*target)
|
||||
.arg(&*target);
|
||||
|
||||
if quiet {
|
||||
cmd.arg("quiet");
|
||||
}
|
||||
|
||||
let mut child = cmd
|
||||
.spawn()
|
||||
.into_diagnostic()
|
||||
.wrap_err("Spawning cargo install failed.")?;
|
||||
|
|
|
@ -335,6 +335,7 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
|||
manifest_path: opts.manifest_path.take(),
|
||||
cli_overrides,
|
||||
desired_targets,
|
||||
quiet: opts.log_level == LevelFilter::Off,
|
||||
});
|
||||
|
||||
let tasks: Vec<_> = if !opts.dry_run && !opts.no_confirm {
|
||||
|
|
Loading…
Add table
Reference in a new issue