]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/lib.rs
Clean up `&args[..]`, use more readable `args.iter()` instead
[rust.git] / src / bootstrap / lib.rs
index 5d32b4f801a183fb22247e16f7bffcb99aab1d36..a4e35bf6d475b64919072f4bd42686250e9de746 100644 (file)
 use crate::builder::Kind;
 use crate::config::{LlvmLibunwind, TargetSelection};
 use crate::util::{
-    exe, libdir, mtime, output, run, run_suppressed, t, try_run, try_run_suppressed, CiEnv,
+    check_run, exe, libdir, mtime, output, run, run_suppressed, t, try_run, try_run_suppressed,
+    CiEnv,
 };
 
 mod builder;
@@ -961,6 +962,17 @@ fn try_run_quiet(&self, cmd: &mut Command) -> bool {
         try_run_suppressed(cmd)
     }
 
+    /// Runs a command, printing out nice contextual information if it fails.
+    /// Returns false if do not execute at all, otherwise returns its
+    /// `status.success()`.
+    fn check_run(&self, cmd: &mut Command) -> bool {
+        if self.config.dry_run {
+            return true;
+        }
+        self.verbose(&format!("running: {:?}", cmd));
+        check_run(cmd, self.is_verbose())
+    }
+
     pub fn is_verbose(&self) -> bool {
         self.verbosity > 0
     }