about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-07-31 21:06:10 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-07-31 21:06:10 +0000
commit5659426c2a4d6465f915a86257d01ea6b8c7a984 (patch)
treed3c479e0f5a11e85c4d00352a98dc1950b32620a /Src
parent9a17762b0cdf0112f54a86e7937118422ba65614 (diff)
downloadzsh-5659426c2a4d6465f915a86257d01ea6b8c7a984.tar.gz
zsh-5659426c2a4d6465f915a86257d01ea6b8c7a984.tar.xz
zsh-5659426c2a4d6465f915a86257d01ea6b8c7a984.zip
always print job status if non-zero status and PRINTEXITSVALUE
Diffstat (limited to 'Src')
-rw-r--r--Src/jobs.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/Src/jobs.c b/Src/jobs.c
index a3cf4711b..4560bf4e2 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -837,7 +837,7 @@ printjob(Job jn, int lng, int synch)
     Process pn;
     int job, len = 9, sig, sflag = 0, llen;
     int conted = 0, lineleng = columns, skip = 0, doputnl = 0;
-    int doneprint = 0;
+    int doneprint = 0, skip_print = 0;
     FILE *fout = (synch == 2 || !shout) ? stdout : shout;
 
     if (oldjobtab != NULL)
@@ -846,16 +846,7 @@ printjob(Job jn, int lng, int synch)
 	job = jn - jobtab;
 
     if (jn->stat & STAT_NOPRINT) {
-	if (jn->stat & STAT_DONE) {
-	    deletejob(jn);
-	    if (job == curjob) {
-		curjob = prevjob;
-		prevjob = job;
-	    }
-	    if (job == prevjob)
-		setprevjob();
-	}
-	return 0;
+	skip_print = 1;
     }
 
     if (lng < 0) {
@@ -889,11 +880,26 @@ printjob(Job jn, int lng, int synch)
 		if (job == thisjob && sig == SIGTSTP)
 		    doputnl = 1;
 	    } else if (isset(PRINTEXITVALUE) && isset(SHINSTDIN) &&
-		       WEXITSTATUS(pn->status))
+		       WEXITSTATUS(pn->status)) {
 		sflag = 1;
+		skip_print = 0;
+	    }
 	}
     }
 
+    if (skip_print) {
+	if (jn->stat & STAT_DONE) {
+	    deletejob(jn);
+	    if (job == curjob) {
+		curjob = prevjob;
+		prevjob = job;
+	    }
+	    if (job == prevjob)
+		setprevjob();
+	}
+	return 0;
+    }
+
     /*
      * - Always print if called from jobs
      * - Otherwise, require MONITOR option ("jobbing") and some