Centralize command running in boostrap (part one) by Kobzol · Pull Request #116581 · rust-lang/rust (original) (raw)

This PR tries to consolidate the various run, try_run, run_quiet, run_quiet_delaying_failure, run_delaying_failure etc. methods on Builder. This PR only touches command execution which doesn't produce output that would be later read by bootstrap, and it also only refactors spawning of commands that happens after a builder is created (commands executed during download & git submodule checkout are left as-is, for now).

The run_cmd method is quite meaty, but I expect that it will be changing rapidly soon, so I considered it easy to kept everything in a single method, and only after things settle down a bit, then maybe again split it up a bit.

I still kept the original shortcut methods like run_quiet_delaying_failure, but they now only delegate to run_cmd. I tried to keep the original behavior (or as close to it as possible) for all the various commands, but it is a giant mess, so there may be some deviations. Notably, cmd.output() is now always called, instead of just status(), which was called previously in some situations.

Apart from the refactored methods, there is also Config::try_run, check_run, methods that run commands that produce output, oh my… that's left for follow-up PRs :)

The driving goal of this (and following) refactors is to centralize command execution in bootstrap on a single place, to make command mocking feasible.

r? @onur-ozkan