From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18962 invoked by alias); 20 Jul 2016 12:21:24 -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: X-Seq: 38897 Received: (qmail 11320 invoked from network); 20 Jul 2016 12:21:24 -0000 X-Qmail-Scanner-Diagnostics: from mailout3.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(210.118.77.13):SA:0(-1.3/5.0):. Processed in 0.143031 secs); 20 Jul 2016 12:21:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f5-f792a6d000001302-91-578f6cbc2524 Date: Wed, 20 Jul 2016 13:21:13 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: use of "less" in function and interrupt Message-id: <20160720132113.1d70a4c0@pwslap01u.europe.root.pri> In-reply-to: <20160720113633.GA17431@zira.vinc17.org> References: <20160720113633.GA17431@zira.vinc17.org> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t/xq7p7cvrDDR7N1bU42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGQvvvGEuWMZe8XZjD0sD4wnWLkZODgkBE4nnE2exQ9hiEhfu rWfrYuTiEBJYyijx9vYTFghnBpPEy9svGCGcc4wS6288ZoZwzjJKnPgwnQ2kn0VAVeLQ3plg NpuAocTUTbMZQWwRAXGJs2vPA43i4BAG2jf/czZImFfAXmLWtqNgZ3AKmErseHMGrFUIqGTb y0YmEJtfQF/i6t9PTBDn2UvMvHKGEaJXUOLH5HssIDazgJbE5m1NrBC2vMTmNW+ZIeaoS9y4 u5t9AqPwLCQts5C0zELSsoCReRWjaGppckFxUnqukV5xYm5xaV66XnJ+7iZGSDh/3cG49JjV IUYBDkYlHt6Ig33hQqyJZcWVuYcYJTiYlUR4ubP7w4V4UxIrq1KL8uOLSnNSiw8xSnOwKInz ztz1PkRIID2xJDU7NbUgtQgmy8TBKdXA2BVz+akwm8K2Ffr2x/ecmir/6EiM009LrRY1GY6F HM7+eVu3Ovism8fRL3Gw4aua67/d34uDK4OOiOtN+Dh/VXOPyO/nKxN1tj7X+DzVoiJ26pvd islPtrjfdQh0F3stvXvt8c9vzzXUnK2xSJ9bGN/12oGl1v2z8ITWD2oftlvtWvGjcr6vixJL cUaioRZzUXEiAFwJXSFjAgAA On Wed, 20 Jul 2016 13:36:33 +0200 Vincent Lefevre wrote: > With zsh 5.2, if I type: > > zira% sleep 5 | less > > and Ctrl-C immediately after, this interrupts the "sleep 5" and > everything is fine ("less" ignores the SIGINT). > > But if I use a function: > > zira% tless() { less "$@"; } > zira% sleep 5 | tless > > then "less" is left stopped in background after I type a key. Interestingly, I can get this to happen with sleep 5 | { less } but not sleep 5 | ( less ) I'm not sure what that says about job control, which I've never really understood, but the two cases should be very close as in the second the shell knows it's about to exit and should exec less without an extra fork. I'm guessing that in the failing cases less is somehow being detached from the terminal while in the other cases it isn't and, when you quit less, normal service is resumed. pws