about summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-12-02 09:46:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-12-02 09:46:12 +0000
commit3206b8a2eac54b75a181859cd98130c5219c3126 (patch)
tree64de96a496ae31708bf9ba59065d83a62da600fb /Src/signals.c
parentbc51b97d53d24e5d793d3219940de7daf60d2916 (diff)
downloadzsh-3206b8a2eac54b75a181859cd98130c5219c3126.tar.gz
zsh-3206b8a2eac54b75a181859cd98130c5219c3126.tar.xz
zsh-3206b8a2eac54b75a181859cd98130c5219c3126.zip
27442 plus tweak: wait returns status for $! even if exited
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/signals.c b/Src/signals.c
index 4bc1de016..f67a3e8ca 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -530,6 +530,7 @@ zhandler(int sig)
 	     * Find the process and job containing this pid and
 	     * update it.
 	     */
+	    pn = NULL;
 	    if (findproc(pid, &jn, &pn, 0)) {
 #if defined(HAVE_WAIT3) && defined(HAVE_GETRUSAGE)
 		struct timezone dummy_tz;
@@ -551,6 +552,15 @@ zhandler(int sig)
 		 */
 		get_usage();
 	    }
+	    /*
+	     * Remember the status associated with $!, so we can
+	     * wait for it even if it's exited.  This value is
+	     * only used if we can't find the PID in the job table,
+	     * so it doesn't matter that the value we save here isn't
+	     * useful until the process has exited.
+	     */
+	    if (pn != NULL && pid == lastpid && lastpid_status != -1L)
+		lastpid_status = lastval2;
 	}
         break;