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 a28b736c for ; Tue, 30 Jul 2019 00:41:00 +0000 (UTC) Received: (qmail 3122 invoked by alias); 30 Jul 2019 00:40:54 -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: 24112 Received: (qmail 6876 invoked by uid 1010); 30 Jul 2019 00:40:54 -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/25524. spamassassin: 3.4.2. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 0.777223 secs); 30 Jul 2019 00:40:54 -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, 30 Jul 2019 02:40:19 +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: <20190730004019.GD28524@zira.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20190628110430.GA13790__36317.6205357135$1561719956$gmane$org@zira.vinc17.org> <20190628184134.btrejxp7jyoo6wz6@chaz.gmail.com> <20190629012433.GA23526@zira.vinc17.org> <20190629153055.kb444goqcmpfblac@chaz.gmail.com> <20190706234919.GA14626@zira.vinc17.org> <20190729230817.GA13849@zira.vinc17.org> <20190729231503.GB28524@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-29 16:42:18 -0700, Bart Schaefer wrote: > On Mon, Jul 29, 2019 at 4:15 PM Vincent Lefevre wrote: > > > > zira% (trap '' INT; svn log | { (trap - INT; less;); kill -PIPE 0; }) > > This is fine, but note that "kill ... 0" sends the signal to the whole > process group, which might have unexpected side-effects. Yes, but I think that this is what I eventually expect. For instance, if svn has started a ssh, then the ssh should be killed (whether it is killed by svn or by the kill command above does not seem to matter). BTW, this can be simplified to (trap '' INT; svn log | { (less); kill -PIPE 0 }) because ( list ) Execute list in a subshell. Traps set by the trap builtin are reset to their default values while executing list. so no need to explicitly reset the INT trap to its default value. > Bash and ksh93 manage process groups differently than zsh; this is > related to the way zsh runs the right-hand-side of pipelines in the > current shell when it can. > > I don't know about dash or mksh, but but they must have more zsh-like > group management. Bash, dash and mksh execute both sides in a subshell, but not ksh93, which behaves like zsh, well, with a difference that may be a bug in zsh: { /bin/sleep 10 ; /bin/sleep 20; } | { /bin/sleep 30 ; /bin/sleep 40; } can be interrupted by Ctrl-C in bash, dash, mksh and ksh93, but not in zsh. But if I remove one of the sleep, this can also be interrupted by Ctrl-C in zsh. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)