Skip to content

Commit

Permalink
Avoid more instances of unused command execution in dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jul 13, 2024
1 parent 72c3540 commit 0cce0bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
6 changes: 1 addition & 5 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ') {
Expand Down
16 changes: 6 additions & 10 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 0cce0bb

Please sign in to comment.