From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 9f77304c for ; Tue, 9 Jul 2019 10:09:39 +0000 (UTC) Received: (qmail 19669 invoked by alias); 9 Jul 2019 10:09:28 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24033 Received: (qmail 20463 invoked by uid 1010); 9 Jul 2019 10:09:28 -0000 X-Qmail-Scanner-Diagnostics: from joooj.vinc17.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25503. spamassassin: 3.4.2. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 1.377261 secs); 09 Jul 2019 10:09:28 -0000 X-Envelope-From: vincent@vinc17.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Tue, 9 Jul 2019 12:08:50 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: kill the LHS command of a pipe once the RHS command terminates Message-ID: <20190709100850.GA2516@zira.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20190628110430.GA13790@zira.vinc17.org> <20190706235537.GB14626@zira.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.12.1+33 (6a74e24e) vl-117499 (2019-06-23) On 2019-07-06 21:54:52 -0700, Bart Schaefer wrote: > On Sat, Jul 6, 2019 at 4:56 PM Vincent Lefevre wrote: > > > > On 2019-06-29 09:17:13 -0700, Bart Schaefer wrote: > > > > > > If you're going to kill the right-side with an interrupt or other > > > signal, you'll have to arrange to trap that so that the subsequent > > > kill isn't also skipped. > > > > but I would like to get rid of the job status that appear at the end. > > zsh% () { > setopt localoptions nonotify nomonitor > coproc { echo foo; exec >&-; sleep 60 } > trap "kill $!" INT EXIT > less -f <&p > } I've noticed 2 issues: 1. It can kill a wrong process of the coproc has terminated. One needs to make sure that zsh does not wait for the coproc until the function exits. 2. If the coproc is killed by the trap, I still get a notification. With NOTIFY set globally, this happens during the trap, as I can still see the notification with trap "kill $!; sleep 1" INT EXIT before the 1-second delay from the sleep. A bug in localoptions, which does not take traps into account? If I unset NOTIFY globally, I get the notification just before the prompt is displayed. But I don't think this is expected either, as the child terminated when nomonitor was in effect. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)