From 58c73bab93c03d5bb80bb6b6e8e048372f0bbc9c Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 27 Apr 2013 14:07:25 +0000 Subject: [PATCH] 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. --- bin/sh/jobs.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index c978e3d643a..54f72ea5332 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -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); + } } } }