diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2018-09-24 21:32:40 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2018-09-24 21:32:40 +0100 |
commit | 0a20f4e5a64106d1793dd44d2fa0113417225d0f (patch) | |
tree | 3b9298a9e0f82c020e16b8428a5c137ac0ac1368 /Src/signals.c | |
parent | dc2bfeee26e8f0c72f44b71e7369ae851bac4854 (diff) | |
download | zsh-0a20f4e5a64106d1793dd44d2fa0113417225d0f.tar.gz zsh-0a20f4e5a64106d1793dd44d2fa0113417225d0f.tar.xz zsh-0a20f4e5a64106d1793dd44d2fa0113417225d0f.zip |
43535: Fixes for bg / fg handling of superjobs.
Be more consistent about marking both superjob and subjob as running when sending SIGCONT. Send SIGCONT to superjob / subjob combination any time it is put in foreground, even if thought running, since subjob may invisibly have suspended. When waiting for superjob, wait for subjob, too.
Diffstat (limited to 'Src/signals.c')
-rw-r--r-- | Src/signals.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Src/signals.c b/Src/signals.c index 26d88abc2..f294049c2 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -782,7 +782,20 @@ killjb(Job jn, int sig) if (kill(pn->pid, sig) == -1 && errno != ESRCH) err = -1; - return err; + /* + * The following marks both the superjob and subjob + * as running, as done elsewhere. + * + * It's not entirely clear to me what the right way + * to flag the status of a still-pausd final process, + * as handled above, but we should be cnsistent about + * this inside makerunning() rather than doing anything + * special here. + */ + if (err != -1) + makerunning(jn); + + return err; } if (killpg(jobtab[jn->other].gleader, sig) == -1 && errno != ESRCH) err = -1; @@ -792,8 +805,11 @@ killjb(Job jn, int sig) return err; } - else - return killpg(jn->gleader, sig); + else { + err = killpg(jn->gleader, sig); + if (sig == SIGCONT && err != -1) + makerunning(jn); + } } for (pn = jn->procs; pn; pn = pn->next) { /* |