Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: less with subprocess
- X-seq: zsh-users 27185
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: less with subprocess
- Date: Thu, 30 Sep 2021 21:17:06 +0200
- Archived-at: <https://zsh.org/users/27185>
- In-reply-to: <CAH+w=7an7ATJ51o-67ztFX+ShfEbrf158+Xi7OPtrm0X82vSbg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- References: <CAH+w=7aUMP3yw8L_Q51JU5AO1yrrCpVigkoOEagTO+iuKZ8R=A@mail.gmail.com> <CAH+w=7bCC--sF2_FGoB-B17RxGoSzcVTzRbuddqOnU_gtO=pXQ@mail.gmail.com> <CAP+y1xDdPi=DHR0KNrdCRiroC-54ev8HhfPW5O+59ap1COLBSg@mail.gmail.com> <20210927233143.GA16620@gmx.de> <CAH+w=7YOFKGfihX5794JVxcXTtS_QrAFpHAmaAotJOAYO7JMzg@mail.gmail.com> <CAH+w=7ZVWU444iL0u_RLfa-ormZTos+7M8iUQo-QqowqioFzCg@mail.gmail.com> <20210928185230.GA7495@gmx.de> <CAH+w=7ZgPGYngBrDEwcGqjrJ8GuLZ0Pn6VO9jDjvWz=_MPTzrw@mail.gmail.com> <20210929130217.GB25513@cventin.lip.ens-lyon.fr> <CAH+w=7an7ATJ51o-67ztFX+ShfEbrf158+Xi7OPtrm0X82vSbg@mail.gmail.com>
On 2021-09-29 07:14:23 -0700, Bart Schaefer wrote:
> On Wed, Sep 29, 2021 at 6:02 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> >
> > cventin% LF () { () { cat >$1 &! less $1 ; kill $! } =(:) }
> > cventin% echo | LF
> > (anon):kill: kill 27684 failed: no such process
>
> Yeah, if you use it with a process that produces very little output,
> the kill will fail. But there's no point in using it in that case.
You don't always know in advance whether there will be little output.
And even with a lot of output, "kill" fails. Basically, the "cat" will
terminate as soon as the command terminates (there is no blocking due
to buffering like with a pipe).
There's another major issue: since there is no blocking, this can take
much disk space. Thus such a function must not be used in a case one
may be interested only in the beginning of the output.
> Redirect stderr of kill if this bothers you.
This won't solve the issue that "kill" may kill an arbitrary process.
I'd say that my patch on "less" provides a better solution.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - 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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author