virtual ~RealCommandRunner() {}
virtual bool CanRunMore();
virtual bool StartCommand(Edge* edge);
- virtual void WaitForCommands();
+ virtual bool WaitForCommands();
virtual Edge* NextFinishedCommand(bool* success);
SubprocessSet subprocs_;
return true;
}
-void RealCommandRunner::WaitForCommands() {
- while (subprocs_.finished_.empty() && !subprocs_.running_.empty()) {
+bool RealCommandRunner::WaitForCommands() {
+ if (subprocs_.running_.empty())
+ return false;
+
+ while (subprocs_.finished_.empty()) {
subprocs_.DoWork();
}
+ return true;
}
Edge* RealCommandRunner::NextFinishedCommand(bool* success) {
finished_.push(edge);
return true;
}
- virtual void WaitForCommands() {
+ virtual bool WaitForCommands() {
+ return true;
}
virtual Edge* NextFinishedCommand(bool* success) {
if (finished_.empty())
}
FinishEdge(edge);
} else {
- command_runner_->WaitForCommands();
+ if (!command_runner_->WaitForCommands()) {
+ *err = "stuck [this is a bug]";
+ return false;
+ }
}
}
virtual ~CommandRunner() {}
virtual bool CanRunMore() = 0;
virtual bool StartCommand(Edge* edge) = 0;
- virtual void WaitForCommands() = 0;
+ // Wait for commands to make progress; return false if there is no
+ // progress to be made.
+ virtual bool WaitForCommands() = 0;
virtual Edge* NextFinishedCommand(bool* success) = 0;
};
// CommandRunner impl
virtual bool CanRunMore();
virtual bool StartCommand(Edge* edge);
- virtual void WaitForCommands();
+ virtual bool WaitForCommands();
virtual Edge* NextFinishedCommand(bool* success);
// DiskInterface
return false;
}
-void BuildTest::WaitForCommands() {
+bool BuildTest::WaitForCommands() {
+ return true;
}
Edge* BuildTest::NextFinishedCommand(bool* success) {