Subject: Re: use of "less" in function and interrupt
From: Vincent Lefevre <[email-masked]>
To: [email-masked]
Date: Thu, 21 Jul 2016 20:51:33 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On 2016-07-20 20:40:47 -0700, Bart Schaefer wrote:
> On Jul 20,  1:21pm, Peter Stephenson wrote:
> } Subject: Re: use of "less" in function and interrupt
> }
> } On Wed, 20 Jul 2016 13:36:33 +0200
> } Vincent Lefevre <[email-masked]> wrote:
> } > With zsh 5.2, if I type:
> } > 
> } > zira% tless() { less "$@"; }
> } > zira% sleep 5 | tless
> } > 
> } > then "less" is left stopped in background after I type a key.
> 
> After you type ^C, you mean?

After I type ^C, I get the zsh prompt back, but "less" is not stopped
yet. And if I type one or several other keys, "less" gets stopped.
Something like that.

> } Interestingly, I can get this to happen with
> } 
> } sleep 5 | { less }
> 
> In both cases it works as expected provided that "sleep 5" has exited,
> so you have to interrupt the sleep.

Yes, that's the goal of the sleep: to leave some time for the user
to interrupt the command.

In the reality for me, the sleep is actually some command that does
some output (often not immediately) and the function is a wrapper
to less.

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)