Skip to content

Commit b68172a

Browse files
committed
Use run_cmd in run
1 parent 86f712f commit b68172a

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/bootstrap/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use once_cell::sync::OnceCell;
3636

3737
use crate::builder::Kind;
3838
use crate::config::{LlvmLibunwind, TargetSelection};
39-
use crate::util::{dir_is_empty, exe, libdir, mtime, output, run, symlink_dir};
39+
use crate::util::{dir_is_empty, exe, libdir, mtime, output, symlink_dir};
4040

4141
mod builder;
4242
mod cache;
@@ -966,11 +966,7 @@ impl Build {
966966

967967
/// Runs a command, printing out nice contextual information if it fails.
968968
fn run(&self, cmd: &mut Command) {
969-
if self.config.dry_run() {
970-
return;
971-
}
972-
self.verbose(&format!("running: {cmd:?}"));
973-
run(cmd, self.is_verbose())
969+
self.run_cmd(cmd);
974970
}
975971

976972
/// Runs a command, printing out nice contextual information if it fails.
@@ -1021,15 +1017,15 @@ impl Build {
10211017
writeln!(
10221018
message,
10231019
"\n\ncommand did not execute successfully: {:?}\n\
1024-
expected success, got: {}\n\n",
1020+
expected success, got: {}\n\n",
10251021
command.command, output.status
10261022
)
10271023
.unwrap();
10281024
if let OutputOnFailure::Verbose = output_on_failure {
10291025
writeln!(
10301026
message,
10311027
"stdout ----\n{}\n\
1032-
stderr ----\n{}\n\n",
1028+
stderr ----\n{}\n\n",
10331029
String::from_utf8_lossy(&output.stdout),
10341030
String::from_utf8_lossy(&output.stderr)
10351031
)

src/bootstrap/util.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Simple things like testing the various filesystem operations here and there,
44
//! not a lot of interesting happenings here unfortunately.
55
6-
use build_helper::util::{fail, try_run};
6+
use build_helper::util::fail;
77
use std::env;
88
use std::fs;
99
use std::io;
@@ -216,12 +216,6 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
216216
}
217217
}
218218

219-
pub fn run(cmd: &mut Command, print_cmd_on_fail: bool) {
220-
if try_run(cmd, print_cmd_on_fail).is_err() {
221-
crate::exit!(1);
222-
}
223-
}
224-
225219
pub fn check_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool {
226220
let status = match cmd.status() {
227221
Ok(status) => status,

0 commit comments

Comments
 (0)