diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-11-13 05:49:16 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-02-04 21:46:12 (GMT) |
commit | 85ff781fa30fff63c01ccd30faaad39d766e1505 (patch) | |
tree | dc5791da4769c61951735e84febcccfa8acf98d2 /src/build.h | |
parent | b07e183e0eb6225e34a3d592e3dff63bcf00df81 (diff) | |
download | Ninja-85ff781fa30fff63c01ccd30faaad39d766e1505.zip Ninja-85ff781fa30fff63c01ccd30faaad39d766e1505.tar.gz Ninja-85ff781fa30fff63c01ccd30faaad39d766e1505.tar.bz2 |
Implement cleanup-on-interrupt
This causes us to clean up by deleting any output files belonging
to currently-running commands before we quit if we are interrupted
(either by Ctrl-C or by a command failing).
Fixes issue #110.
Diffstat (limited to 'src/build.h')
-rw-r--r-- | src/build.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/build.h b/src/build.h index 586d1ff..c75bde1 100644 --- a/src/build.h +++ b/src/build.h @@ -20,8 +20,11 @@ #include <string> #include <queue> #include <vector> +#include <memory> using namespace std; +#include "exit_status.h" + struct BuildLog; struct Edge; struct DiskInterface; @@ -87,7 +90,9 @@ struct CommandRunner { virtual bool CanRunMore() = 0; virtual bool StartCommand(Edge* edge) = 0; /// Wait for a command to complete. - virtual Edge* WaitForCommand(bool* success, string* output) = 0; + virtual Edge* WaitForCommand(ExitStatus* status, string* output) = 0; + virtual vector<Edge*> GetActiveEdges() { return vector<Edge*>(); } + virtual void Abort() {} }; /// Options (e.g. verbosity, parallelism) passed to a build. @@ -109,6 +114,7 @@ struct BuildConfig { /// Builder wraps the build process: starting commands, updating status. struct Builder { Builder(State* state, const BuildConfig& config); + ~Builder(); Node* AddTarget(const string& name, string* err); @@ -130,9 +136,14 @@ struct Builder { const BuildConfig& config_; Plan plan_; DiskInterface* disk_interface_; - CommandRunner* command_runner_; + auto_ptr<CommandRunner> command_runner_; struct BuildStatus* status_; struct BuildLog* log_; + +private: + // Unimplemented copy ctor and operator= ensure we don't copy the auto_ptr. + Builder(const Builder &other); // DO NOT IMPLEMENT + void operator=(const Builder &other); // DO NOT IMPLEMENT }; #endif // NINJA_BUILD_H_ |