diff options
author | Evan Martin <martine@danga.com> | 2012-12-29 18:53:59 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-04-08 21:45:06 (GMT) |
commit | 695a8e5704d390c84737292b06a2ec97aab52093 (patch) | |
tree | c040434bbdef17392046f964f79cddb15efe7125 /src/build_test.cc | |
parent | b6a9a1c8adbb444c2489d884f06e5bd39627c3e9 (diff) | |
download | Ninja-695a8e5704d390c84737292b06a2ec97aab52093.zip Ninja-695a8e5704d390c84737292b06a2ec97aab52093.tar.gz Ninja-695a8e5704d390c84737292b06a2ec97aab52093.tar.bz2 |
pass command results via a struct
WaitForCommand now passes all command output via a struct.
This will allow adding more output in a future change.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r-- | src/build_test.cc | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/build_test.cc b/src/build_test.cc index d4468a3..a74beb9 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -383,7 +383,7 @@ struct FakeCommandRunner : public CommandRunner { // CommandRunner impl virtual bool CanRunMore(); virtual bool StartCommand(Edge* edge); - virtual Edge* WaitForCommand(ExitStatus* status, string* output); + virtual bool WaitForCommand(Result* result); virtual vector<Edge*> GetActiveEdges(); virtual void Abort(); @@ -457,24 +457,25 @@ bool FakeCommandRunner::StartCommand(Edge* edge) { return true; } -Edge* FakeCommandRunner::WaitForCommand(ExitStatus* status, - string* /* output */) { - if (Edge* edge = last_command_) { - if (edge->rule().name() == "interrupt" || - edge->rule().name() == "touch-interrupt") { - *status = ExitInterrupted; - return NULL; - } +bool FakeCommandRunner::WaitForCommand(Result* result) { + if (!last_command_) + return false; - if (edge->rule().name() == "fail") - *status = ExitFailure; - else - *status = ExitSuccess; - last_command_ = NULL; - return edge; + Edge* edge = last_command_; + result->edge = edge; + + if (edge->rule().name() == "interrupt" || + edge->rule().name() == "touch-interrupt") { + result->status = ExitInterrupted; + return true; } - *status = ExitFailure; - return NULL; + + if (edge->rule().name() == "fail") + result->status = ExitFailure; + else + result->status = ExitSuccess; + last_command_ = NULL; + return true; } vector<Edge*> FakeCommandRunner::GetActiveEdges() { |