diff options
| author | jyn <github@jyn.dev> | 2023-07-15 18:52:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-15 18:52:31 -0500 |
| commit | 90c74e20ce4892825fd0acda1ded1fa098cf0284 (patch) | |
| tree | 2a95c34fa05a71176121f37bfed40aafd774fcb2 /src/bootstrap/config.rs | |
| parent | 4c8bb79d9f565115637cc6da739f8389e79f3a29 (diff) | |
| parent | c0c6a24f89119848c27eb5267a6cf25dd468c1cb (diff) | |
Rollup merge of #113643 - jyn514:try-run, r=ozkanonur
bootstrap: Clean up try_run r? `@ozkanonur` since you reviewed `@GuillaumeGomez's` PR i recommend reviewing commit-by-commit
Diffstat (limited to 'src/bootstrap/config.rs')
| -rw-r--r-- | src/bootstrap/config.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e907ecb7485..856a73a22b5 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1742,6 +1742,18 @@ impl Config { } } + /// 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()`. + #[deprecated = "use `Builder::try_run` instead where possible"] + pub(crate) fn try_run(&self, cmd: &mut Command) -> Result<(), ()> { + if self.dry_run() { + return Ok(()); + } + self.verbose(&format!("running: {:?}", cmd)); + build_helper::util::try_run(cmd, self.is_verbose()) + } + /// A git invocation which runs inside the source directory. /// /// Use this rather than `Command::new("git")` in order to support out-of-tree builds. |
