zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: use of "less" in function and interrupt
Date: Wed, 20 Jul 2016 13:21:13 +0100	[thread overview]
Message-ID: <20160720132113.1d70a4c0@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20160720113633.GA17431@zira.vinc17.org>

On Wed, 20 Jul 2016 13:36:33 +0200
Vincent Lefevre <vincent@vinc17.net> 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


  reply	other threads:[~2016-07-20 12:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 11:36 Vincent Lefevre
2016-07-20 12:21 ` Peter Stephenson [this message]
2016-07-21  3:40   ` Bart Schaefer
2016-07-21 18:51     ` Vincent Lefevre
2016-07-23 17:02     ` Bart Schaefer
2016-07-25 13:40       ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160720132113.1d70a4c0@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).