about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--Src/exec.c4
-rw-r--r--Src/jobs.c19
3 files changed, 26 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ddef4f18e..078971581 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,15 @@
 	* 29661: Doc/Zsh/redirect.yo: Improve the documentation for
 	{var}>... redirections.
 
+2011-08-09  Barton E. Schaefer  <schaefer@brasslantern.com>
+
+	* 29654: Src/jobs.c: "wait" should resume stopped jobs identified
+	by process ID as well as by job number.
+
+	* 29654: Src/exec.c: don't hide the job table entry for the left
+	side of a pipline that ends in a shell builtin.  This change may
+	be backed out if the patch in 29660 can be improved.
+
 2011-08-03  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 29644: Functions/Chpwd/zsh_directory_name_cdr,
@@ -15204,5 +15213,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5416 $
+* $Revision: 1.5417 $
 *****************************************************
diff --git a/Src/exec.c b/Src/exec.c
index 6320f6a67..569c41cf7 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2845,7 +2845,9 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	/* This is a current shell procedure that didn't need to fork.    *
 	 * This includes current shell procedures that are being exec'ed, *
 	 * as well as null execs.                                         */
-	jobtab[thisjob].stat |= STAT_CURSH|STAT_NOPRINT;
+	jobtab[thisjob].stat |= STAT_CURSH;
+	if (!jobtab[thisjob].procs)
+	    jobtab[thisjob].stat |= STAT_NOPRINT;
     } else {
 	/* This is an exec (real or fake) for an external command.    *
 	 * Note that any form of exec means that the subshell is fake *
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) {