about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2018-09-16 19:13:38 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2018-09-16 19:13:38 +0100
commit551ff842721d6ca83727dbe6cd40178f46cc8201 (patch)
tree88fcee0886f87535240a527de45c41fc99de6662 /Src/exec.c
parent301ca1229a6ca967f8bd7d3c379ff6b9983a3673 (diff)
downloadzsh-551ff842721d6ca83727dbe6cd40178f46cc8201.tar.gz
zsh-551ff842721d6ca83727dbe6cd40178f46cc8201.tar.xz
zsh-551ff842721d6ca83727dbe6cd40178f46cc8201.zip
43464: Another attachtty() fix.
If list_pipe_job triggered more than once we need to know
the most recent process group leader, so record that
both if the attach happened in the main shell on in
entersubsh().

Also don't pass back proocess group for ESUB_ASYNC subshells.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Src/exec.c b/Src/exec.c
index b9af9ea63..a667b078d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1036,7 +1036,7 @@ entersubsh(int flags, struct entersubsh_ret *retp)
 		if (!(flags & ESUB_ASYNC))
 		    attachtty(jobtab[thisjob].gleader);
 	    }
-	    if (retp) {
+	    if (retp && !(flags & ESUB_ASYNC)) {
 		retp->gleader = jobtab[list_pipe_job].gleader;
 		retp->list_pipe_job = list_pipe_job;
 	    }
@@ -1058,12 +1058,13 @@ entersubsh(int flags, struct entersubsh_ret *retp)
 		!jobtab[list_pipe_job].gleader)
 		jobtab[list_pipe_job].gleader = jobtab[thisjob].gleader;
 	    setpgrp(0L, jobtab[thisjob].gleader);
-	    if (!(flags & ESUB_ASYNC))
+	    if (!(flags & ESUB_ASYNC)) {
 		attachtty(jobtab[thisjob].gleader);
-	    if (retp) {
-		retp->gleader = jobtab[thisjob].gleader;
-		if (list_pipe_job != thisjob)
-		    retp->list_pipe_job = list_pipe_job;
+		if (retp) {
+		    retp->gleader = jobtab[thisjob].gleader;
+		    if (list_pipe_job != thisjob)
+			retp->list_pipe_job = list_pipe_job;
+		}
 	    }
 	}
     }