Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: pipeline that cannot be interrupted



On Wed, Apr 27, 2022 at 1:29 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Naively, the following not-really-a-patch-yet fixes it, and all tests
> still pass.

Does this make more sense?
diff --git a/Src/jobs.c b/Src/jobs.c
index af0a1233d..85d4c4d1f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1476,7 +1476,10 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
 	 * set it for that, too.
 	 */
 	if (gleader != -1) {
-	    jobtab[thisjob].gleader = gleader;
+	    if (jobtab[thisjob].stat & STAT_CURSH)
+		jobtab[thisjob].gleader = gleader;
+	    else
+		jobtab[thisjob].gleader = pid;
 	    if (list_pipe_job_used != -1)
 		jobtab[list_pipe_job_used].gleader = gleader;
 	    /*


Messages sorted by: Reverse Date, Date, Thread, Author