sh: Don't consider jobs -s/-p as reporting the status of jobs.

This ensures that something like j=$(jobs -p) does not prevent any
status from being written to the terminal.
This commit is contained in:
Jilles Tjoelker 2013-04-27 14:07:25 +00:00
parent f35bb1a01e
commit 58c73bab93
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249984

View File

@ -417,13 +417,15 @@ showjobs(int change, int mode)
if (change && ! jp->changed)
continue;
showjob(jp, mode);
jp->changed = 0;
/* Hack: discard jobs for which $! has not been referenced
* in interactive mode when they terminate.
*/
if (jp->state == JOBDONE && !jp->remembered &&
(iflag || jp != bgjob)) {
freejob(jp);
if (mode == SHOWJOBS_DEFAULT || mode == SHOWJOBS_VERBOSE) {
jp->changed = 0;
/* Hack: discard jobs for which $! has not been
* referenced in interactive mode when they terminate.
*/
if (jp->state == JOBDONE && !jp->remembered &&
(iflag || jp != bgjob)) {
freejob(jp);
}
}
}
}