From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26986 invoked from network); 13 May 2020 06:29:59 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 13 May 2020 06:29:59 -0000 Received: (qmail 20955 invoked by alias); 13 May 2020 06:29:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45825 Received: (qmail 3186 invoked by uid 1010); 13 May 2020 06:29:48 -0000 X-Qmail-Scanner-Diagnostics: from relay1-d.mail.gandi.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25807. spamassassin: 3.4.4. Clear:RC:0(217.70.183.193):SA:0(-2.6/5.0):. Processed in 1.877313 secs); 13 May 2020 06:29:48 -0000 X-Envelope-From: stephane@chazelas.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _nblcust.gandi.net designates 217.70.183.193 as permitted sender) X-Originating-IP: 94.3.152.49 Date: Wed, 13 May 2020 07:29:02 +0100 From: Stephane Chazelas To: Bart Schaefer Cc: Rudi C , "zsh-workers@zsh.org" Subject: Re: [Bug] Unexpected process suspension Message-ID: <20200513062902.gf6e22g4sqni75x4@chazelas.org> Mail-Followup-To: Bart Schaefer , Rudi C , "zsh-workers@zsh.org" References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 2020-05-12 10:38:38 -0700, Bart Schaefer: > On Tue, May 12, 2020 at 12:03 AM Rudi C wrote: > > > > mdoc-test () { > > > > sleep 0 | sleep 0 > > cat} > > > > echo start |VISUAL=vim command vipe|mdoc-test > > > > # zsh: suspended (tty output) > > Putting an interactive command in the middle of a pipeline is > generally not going to work. Vim in particular is pretty aggressive > about trying to grab a terminal, which will result in processes > getting SIGTT* because they don't have foreground control of the > terminal they're trying to use. [...] The thing is vim *should* be in the foreground, all the processes started in pipeline should be in the same process group which should be in foreground (so it gets SIGINT/SIGQUIT/SIGTSTP upon ^C/^\/^Z, so it can read the terminal, etc) but under some circumstances, zsh fails to put some processes in that group, which is a bug. $ &2 127235 127235 $ &2 | ps -o pid,pgid,comm 131569 131569 PID PGID COMMAND 124948 124948 zsh 131569 131569 awk 131570 131569 ps 131571 131569 sleep $ &2 | { :; } 127410 127410 $ &2 | { : | :; } 127496 124948 In that latter case, awk is in a different process group (127496) from the terminal foreground process group (124948 which here is the process group of the main shell process!). -- Stephane