diff options
-rw-r--r-- | src/build.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/build.cc b/src/build.cc index d3e88ee..2b9c657 100644 --- a/src/build.cc +++ b/src/build.cc @@ -479,10 +479,6 @@ struct DryRunCommandRunner : public CommandRunner { Builder::Builder(State* state, const BuildConfig& config) : state_(state), config_(config) { disk_interface_ = new RealDiskInterface; - if (config.dry_run) - command_runner_.reset(new DryRunCommandRunner); - else - command_runner_.reset(new RealCommandRunner(config)); status_ = new BuildStatus(config); log_ = state->build_log_; } @@ -540,6 +536,14 @@ bool Builder::Build(string* err) { int pending_commands = 0; int failures_allowed = config_.failures_allowed; + // Set up the command runner if we haven't done so already. + if (!command_runner_.get()) { + if (config_.dry_run) + command_runner_.reset(new DryRunCommandRunner); + else + command_runner_.reset(new RealCommandRunner(config_)); + } + // This main loop runs the entire build process. // It is structured like this: // First, we attempt to start as many commands as allowed by the |