diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2011-08-10 03:21:15 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2011-08-10 03:21:15 +0000 |
commit | 92ee9324a96cd503c2ebc82cf84c03ddb08bf434 (patch) | |
tree | 3fb5178db4f643667e08efe982f20b8878903d53 /Src/jobs.c | |
parent | e7f198f26705b1d61292eb8a14a7b7e7ac246e42 (diff) | |
download | zsh-92ee9324a96cd503c2ebc82cf84c03ddb08bf434.tar.gz zsh-92ee9324a96cd503c2ebc82cf84c03ddb08bf434.tar.xz zsh-92ee9324a96cd503c2ebc82cf84c03ddb08bf434.zip |
29654: "wait" should resume stopped jobs identified by process ID as well
as by job number; temporary (?) workaround for pipelines getting lost if TSTP is delivered when a shell builtin is the tail of the pipe.
Diffstat (limited to 'Src/jobs.c')
-rw-r--r-- | Src/jobs.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Src/jobs.c b/Src/jobs.c index 9c9b12f5e..d57ebfa61 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -1933,12 +1933,19 @@ bin_fg(char *name, char **argv, Options ops, int func) Process p; if (findproc(pid, &j, &p, 0)) { - /* - * returns 0 for normal exit, else signal+128 - * in which case we should return that status. - */ - retval = waitforpid(pid, 1); - if (!retval) + if (j->stat & STAT_STOPPED) { + retval = (killjb(j, SIGCONT) != 0); + if (retval == 0) + makerunning(j); + } + if (retval == 0) { + /* + * returns 0 for normal exit, else signal+128 + * in which case we should return that status. + */ + retval = waitforpid(pid, 1); + } + if (retval == 0) retval = lastval2; } else if (isset(POSIXJOBS) && pid == lastpid && lastpid_status >= 0L) { |