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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,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 ef8e4768 for ; Sat, 29 Jun 2019 15:31:45 +0000 (UTC) Received: (qmail 25171 invoked by alias); 29 Jun 2019 15:31:35 -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: 23995 Received: (qmail 7708 invoked by uid 1010); 29 Jun 2019 15:31:35 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr1-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25489. spamassassin: 3.4.2. Clear:RC:0(209.85.221.52):SA:0(-2.0/5.0):. Processed in 1.543887 secs); 29 Jun 2019 15:31:35 -0000 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.221.52 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+BNOWq3Q+d0OZ/YyXU2bWgWNlTCi3QwIv3ZvOcfot2o=; b=svRLopjx9l5Cs348zPVCwUQGRLcxfjnnRGWdwL0Is+kUDNUQQRUWjBAZHkK4aEiK16 vHh1CEKVl9xvLlkkZxZ0VMHL8A34J0YgrPkI6IjlISFnxu/Og3gIKiJ2/shAAugojcor a0jW27qe1MPoYWLvEWNbNbH/0l3PwtNNHjTfJkTWYxkTZKnERZu5s05A8BWs6reXVRif /n7wArz+6eZV7zdx0/5dNUuuygANIcvAtLUOs4OA+suLZRMhtQW4giERQiYI/90mVF1i TRPydHKQmxpNs0/IC4O9IohWpmzazx/6mGgtJLuCx1t7NadbEDOJxXS9e/foZwviRZFe L/SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=+BNOWq3Q+d0OZ/YyXU2bWgWNlTCi3QwIv3ZvOcfot2o=; b=k0AOYqp5UVquYxEOllktHIkyG2S2ocp/H70M7XbIDdYvaeQiRjvoJa3cZKj13eI2qO Ol+haqtvaW3R1HGol9eTQRJeV99XF5wU7mxED02Pd3QFKCTleiwlyN2HUrKfCyGvRQvN 0I83uMa377jZBvrQ3RETd1TJaqd6sRBoI06t+hX4WcDQ2i1kTkyEuD0gEheldLHwVhQL RWIMWUqyXDKN1Qf7UteMQYJ4HmtcFd1oXwHIBzAgDTeHUrYUJo6V01VOu17Ut4jMSvkf 3u7AwZDrS+pHRDmbqnhegvlcXT13c2z36YT52iGnYcrDNMH9sRhlfjs+2PrsCr3fZfrA T9pw== X-Gm-Message-State: APjAAAWWcsEjIKMRnWiGn6F1aM82gvclJOjG3aL/MkkQF4qS5suzSBho Q/0BbXBZvjyCHbowyMlJqvTrKS3M X-Google-Smtp-Source: APXvYqwf5WwE4JQ0c/QReUHvMWzQVyN0KFXGCWEYfA7BXvMpc2uV+Qk3bd0Yx60xv4y2gQQgAB95zQ== X-Received: by 2002:adf:f101:: with SMTP id r1mr12340180wro.170.1561822258511; Sat, 29 Jun 2019 08:30:58 -0700 (PDT) Date: Sat, 29 Jun 2019 16:30:55 +0100 From: Stephane Chazelas To: zsh-users@zsh.org Subject: Re: kill the LHS command of a pipe once the RHS command terminates Message-ID: <20190629153055.kb444goqcmpfblac@chaz.gmail.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190629012433.GA23526@zira.vinc17.org> User-Agent: NeoMutt/20171215 2019-06-29 03:24:33 +0200, Vincent Lefevre: [...] > Thus if the left-hand-side process has terminated, this tries to > kill a random process! [...] Fair enough. Then, how about: page-and-kill() ("$@" | { ${PAGER:-less}; kill -s PIPE 0; }) (only for use from an interactive shell where that page-and-kill is run in its own process group). That would also kill the extra processes that the command may spawn. -- Stephane