diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-06-16 02:53:14 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-06-16 02:53:53 -0700 |
commit | 5d75ee7721d9bd09e38375caa3ab2394246c0f3d (patch) | |
tree | a4539caa033f7cf9e0da328fe01ed61acc4cb9e0 /proc.cpp | |
parent | 70208eb33a783579e528b8491166dc9d593153d1 (diff) |
Mark jobs as completed when all processes have finished, not just the last one.
Fixes https://github.com/fish-shell/fish-shell/issues/876 , and coincidentally also https://github.com/fish-shell/fish-shell/issues/848
Diffstat (limited to 'proc.cpp')
-rw-r--r-- | proc.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -296,15 +296,19 @@ int job_is_stopped(const job_t *j) \param j the job to test */ -int job_is_completed(const job_t *j) +bool job_is_completed(const job_t *j) { - process_t *p; assert(j->first_process != NULL); - for (p = j->first_process; p->next; p = p->next) - ; - - return p->completed; - + bool result = true; + for (process_t *p = j->first_process; p != NULL; p = p->next) + { + if (! p->completed) + { + result = false; + break; + } + } + return result; } void job_set_flag(job_t *j, unsigned int flag, int set) |