about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2024-06-20 11:43:42 +0200
committerJakub Beránek <jakub.beranek@vsb.cz>2024-06-20 11:43:42 +0200
commite933cfb13ce6367b8b51b5c40c5041ef16294b08 (patch)
tree70fb757378a71c47f945d494118fcaec41c4721f /src/bootstrap
parent949e667d3fc97770134aaa5ea23be4972fde91ff (diff)
downloadrust-e933cfb13ce6367b8b51b5c40c5041ef16294b08.tar.gz
rust-e933cfb13ce6367b8b51b5c40c5041ef16294b08.zip
Remove `run_quiet_delaying_failure`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs8
-rw-r--r--src/bootstrap/src/lib.rs10
-rw-r--r--src/bootstrap/src/utils/exec.rs5
3 files changed, 10 insertions, 13 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 834257a6e21..7eed3fdb9cb 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2342,11 +2342,11 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
     let test_args = builder.config.test_args().join(" ");
     cmd.arg("--test-args").arg(test_args);
 
-    if builder.config.verbose_tests {
-        builder.run_delaying_failure(&mut cmd)
-    } else {
-        builder.run_quiet_delaying_failure(&mut cmd)
+    let mut cmd = BootstrapCommand::from(&mut cmd).delay_failure();
+    if !builder.config.verbose_tests {
+        cmd = cmd.quiet();
     }
+    builder.run_tracked(cmd).is_success()
 }
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 5b2913b1a83..2c9cc39474f 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -958,6 +958,7 @@ impl Build {
         })
     }
 
+    /// Execute a command and return its output.
     fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
         if self.config.dry_run() {
             return CommandOutput::default();
@@ -1037,15 +1038,6 @@ impl Build {
         ))
     }
 
-    /// Runs a command, printing out nice contextual information if it fails.
-    /// Exits if the command failed to execute at all, otherwise returns its
-    /// `status.success()`.
-    fn run_quiet_delaying_failure(&self, cmd: &mut Command) -> bool {
-        self.run_cmd(
-            BootstrapCommand::from(cmd).delay_failure().output_mode(OutputMode::PrintOnFailure),
-        )
-    }
-
     /// A centralized function for running commands that do not return output.
     pub(crate) fn run_cmd<'a, C: Into<BootstrapCommand<'a>>>(&self, cmd: C) -> bool {
         if self.config.dry_run() {
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 21013345f09..4b7029eebac 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -44,6 +44,11 @@ impl<'a> BootstrapCommand<'a> {
         Self { failure_behavior: BehaviorOnFailure::Ignore, ..self }
     }
 
+    /// Do not print the output of the command, unless it fails.
+    pub fn quiet(self) -> Self {
+        self.output_mode(OutputMode::PrintOnFailure)
+    }
+
     pub fn output_mode(self, output_mode: OutputMode) -> Self {
         Self { output_mode, ..self }
     }