Don’t print Preparing a sysroot when -q/--quiet is passed

This commit is contained in:
Paul Gey 2024-05-01 21:27:49 +02:00
parent 1c7e82762f
commit 1cf951e5c6
2 changed files with 8 additions and 3 deletions

View File

@ -87,6 +87,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
), ),
}; };
let verbose = num_arg_flag("-v"); let verbose = num_arg_flag("-v");
let quiet = has_arg_flag("-q") || has_arg_flag("--quiet");
// Determine the involved architectures. // Determine the involved architectures.
let rustc_version = VersionMeta::for_command(miri_for_host()).unwrap_or_else(|err| { let rustc_version = VersionMeta::for_command(miri_for_host()).unwrap_or_else(|err| {
@ -110,7 +111,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
} }
// We always setup. // We always setup.
let miri_sysroot = setup(&subcommand, target, &rustc_version, verbose); let miri_sysroot = setup(&subcommand, target, &rustc_version, verbose, quiet);
// Invoke actual cargo for the job, but with different flags. // Invoke actual cargo for the job, but with different flags.
// We re-use `cargo test` and `cargo run`, which makes target and binary handling very easy but // We re-use `cargo test` and `cargo run`, which makes target and binary handling very easy but

View File

@ -19,6 +19,7 @@ pub fn setup(
target: &str, target: &str,
rustc_version: &VersionMeta, rustc_version: &VersionMeta,
verbose: usize, verbose: usize,
quiet: bool,
) -> PathBuf { ) -> PathBuf {
let only_setup = matches!(subcommand, MiriCommand::Setup); let only_setup = matches!(subcommand, MiriCommand::Setup);
let ask_user = !only_setup; let ask_user = !only_setup;
@ -119,6 +120,9 @@ pub fn setup(
for _ in 0..verbose { for _ in 0..verbose {
command.arg("-v"); command.arg("-v");
} }
if quiet {
command.arg("--quiet");
}
} else { } else {
// Suppress output. // Suppress output.
command.stdout(process::Stdio::null()); command.stdout(process::Stdio::null());
@ -134,7 +138,7 @@ pub fn setup(
let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"]; let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"];
// Do the build. // Do the build.
if print_sysroot { if print_sysroot || quiet {
// Be silent. // Be silent.
} else { } else {
let mut msg = String::new(); let mut msg = String::new();
@ -169,7 +173,7 @@ pub fn setup(
) )
} }
}); });
if print_sysroot { if print_sysroot || quiet {
// Be silent. // Be silent.
} else if only_setup { } else if only_setup {
eprintln!("A sysroot for Miri is now available in `{}`.", sysroot_dir.display()); eprintln!("A sysroot for Miri is now available in `{}`.", sysroot_dir.display());