summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-07-10 09:10:59 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-10 09:10:59 +0000
commitbd2ee44b78d4b1ef78eac9a897237d63aecc35d6 (patch)
treedf0dab6e05e5013fc7341c5149666bb3d3b4745d
parent5df700fb5b367ed6a5bec0fcac6723bbc3bf24d7 (diff)
downloadzsh-bd2ee44b78d4b1ef78eac9a897237d63aecc35d6.tar.gz
zsh-bd2ee44b78d4b1ef78eac9a897237d63aecc35d6.tar.xz
zsh-bd2ee44b78d4b1ef78eac9a897237d63aecc35d6.zip
27119: job output to stdout if non-interactive
no automated jobs notifications
-rw-r--r--ChangeLog8
-rw-r--r--Src/jobs.c11
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6419ac57c..2965824e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-10  Peter Stephenson  <pws@csr.com>
+
+	* 27119: Src/jobs.c: correct 27112: output is to stdout, not
+	stderr, and there's no automated jobs notification if not
+	INTERACTIVE.
+
 2009-07-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 27112: Src/jobs.c: allow output to stderr if MONITOR but
@@ -11931,5 +11937,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4731 $
+* $Revision: 1.4732 $
 *****************************************************
diff --git a/Src/jobs.c b/Src/jobs.c
index 7f4aed144..0841a45c9 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -828,7 +828,7 @@ printjob(Job jn, int lng, int synch)
     int job, len = 9, sig, sflag = 0, llen;
     int conted = 0, lineleng = columns, skip = 0, doputnl = 0;
     int doneprint = 0;
-    FILE *fout = (synch == 2) ? stdout : shout ? shout : stderr;
+    FILE *fout = (synch == 2 || !shout) ? stdout : shout;
 
     if (oldjobtab != NULL)
 	job = jn - oldjobtab;
@@ -886,8 +886,8 @@ printjob(Job jn, int lng, int synch)
 
 /* print if necessary: ignore option state on explicit call to `jobs'. */
 
-    if (synch == 2 || 
-	(jobbing &&
+    if (synch == 2 ||
+	(interact && jobbing &&
 	 ((jn->stat & STAT_STOPPED) || sflag || job != thisjob))) {
 	int len2, fline = 1;
 	/* use special format for current job, except in `jobs' */
@@ -1380,7 +1380,7 @@ spawnjob(void)
 	} else if (prevjob == -1 || !(jobtab[prevjob].stat & STAT_STOPPED))
 	    prevjob = thisjob;
 	if (jobbing && jobtab[thisjob].procs) {
-	    FILE *fout = shout ? shout : stderr;
+	    FILE *fout = shout ? shout : stdout;
 	    fprintf(fout, "[%d]", thisjob);
 	    for (pn = jobtab[thisjob].procs; pn; pn = pn->next)
 		fprintf(fout, " %ld", (long) pn->pid);
@@ -1908,8 +1908,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
 		printjob(jobtab + job, (stopped) ? -1 : lng, 1);
 	    if (func != BIN_BG) {		/* fg or wait */
 		if (jobtab[job].pwd && strcmp(jobtab[job].pwd, pwd)) {
-		    FILE *fout = (func == BIN_JOBS) ? stdout : shout ?
-			shout : stderr;
+		    FILE *fout = (func == BIN_JOBS || !shout) ? stdout : shout;
 		    fprintf(fout, "(pwd : ");
 		    fprintdir(jobtab[job].pwd, fout);
 		    fprintf(fout, ")\n");