From 61610ea4bdc3e2de11c258017f377db3d1d6d993 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Wed, 9 Nov 2022 20:24:57 -0800 Subject: 50922: fix additional cases of signals for current shell jobs on the right of a pipeline. Backs out part of 188c5cd5 (workers/50874). With this change, after a new subshell is forked upon suspend of the right side of a pipeline, the previous foreground subjob is resumed first and the new subshell remains stopped until that job finishes. --- Src/exec.c | 8 ++++++-- Src/jobs.c | 6 ------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'Src') diff --git a/Src/exec.c b/Src/exec.c index 2422dae91..d4e681887 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1899,8 +1899,12 @@ execpline(Estate state, wordcode slcode, int how, int last1) break; } } - else if (subsh && jn->stat & STAT_STOPPED) - thisjob = newjob; + else if (subsh && jn->stat & STAT_STOPPED) { + if (thisjob == newjob) + makerunning(jn); + else + thisjob = newjob; + } else break; } diff --git a/Src/jobs.c b/Src/jobs.c index 76c762ee5..4863962b9 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -564,12 +564,6 @@ update_job(Job jn) * when the job is finally deleted. */ jn->stat |= STAT_ATTACH; - /* - * If we're in shell jobs on the right side of a pipeline - * we should treat it like a job in the current shell. - */ - if (inforeground == 2) - inforeground = 1; } /* If we have `foo|while true; (( x++ )); done', and hit * ^C, we have to stop the loop, too. */ -- cgit 1.4.1