bool
show_jobs_on_console (bool progress)
{
- bool should_stop = false;
bool first = true;
bool error = false;
- while (!should_stop) {
+ while (true) {
dcpomatic_sleep (5);
first = false;
- int unfinished = 0;
- int finished_in_error = 0;
-
BOOST_FOREACH (shared_ptr<Job> i, jobs) {
if (progress) {
cout << i->name();
}
}
- if (!i->finished ()) {
- ++unfinished;
- }
-
- if (i->finished_in_error ()) {
- ++finished_in_error;
- error = true;
- }
-
- if (!progress && i->finished_in_error ()) {
+ if (!progress && i->finished_in_error()) {
/* We won't see this error if we haven't been showing progress,
so show it now.
*/
cout << i->status() << "\n";
}
+
+ if (i->finished_in_error()) {
+ error = true;
+ }
}
- if (unfinished == 0 || finished_in_error != 0) {
- should_stop = true;
+ if (!JobManager::instance()->work_to_do()) {
+ break;
}
}