Avoid more instances of unused command execution in dry run

This commit is contained in:
Jakub Beránek 2024-07-13 11:41:29 +02:00
parent 72c354094d
commit 0cce0bb204
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
2 changed files with 7 additions and 15 deletions

View file

@ -2068,11 +2068,7 @@ fn maybe_install_llvm(
let mut cmd = command(llvm_config);
cmd.arg("--libfiles");
builder.verbose(|| println!("running {cmd:?}"));
let files = if builder.config.dry_run() {
"".into()
} else {
cmd.capture_stdout().run(builder).stdout()
};
let files = cmd.capture_stdout().run(builder).stdout();
let build_llvm_out = &builder.llvm_out(builder.config.build);
let target_llvm_out = &builder.llvm_out(target);
for file in files.trim_end().split(' ') {

View file

@ -471,16 +471,12 @@ impl Miri {
// We re-use the `cargo` from above.
cargo.arg("--print-sysroot");
if builder.config.dry_run() {
String::new()
} else {
builder.verbose(|| println!("running: {cargo:?}"));
let stdout = cargo.capture_stdout().run(builder).stdout();
// Output is "<sysroot>\n".
let sysroot = stdout.trim_end();
builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
sysroot.to_owned()
}
builder.verbose(|| println!("running: {cargo:?}"));
let stdout = cargo.capture_stdout().run(builder).stdout();
// Output is "<sysroot>\n".
let sysroot = stdout.trim_end();
builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
sysroot.to_owned()
}
}