Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to propagate SIGTERM to the foreground job, if any?
- X-seq: zsh-users 29851
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to propagate SIGTERM to the foreground job, if any?
- Date: Sun, 21 Apr 2024 19:29:09 +0200
- Archived-at: <https://zsh.org/users/29851>
- In-reply-to: <CAH+w=7bKk-Ch9MUe_T9YnhX-Prqs=m5iAfJPimc+6nVQSraF9A@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- References: <20240419171752.GA48158@cventin.lip.ens-lyon.fr> <CAH+w=7a_CC-PE=XWjQfSfbNbQM3XX=TywXJoEf0mkD8_cKErmw@mail.gmail.com> <20240419190027.GA109916@joooj.vinc17.net> <CAH+w=7atm3k6WwkhuywjPQC0eOB7W+3VvjWjR6jMk-JVExDpZQ@mail.gmail.com> <20240419213225.GA146837@qaa.vinc17.org> <CAH+w=7bKk-Ch9MUe_T9YnhX-Prqs=m5iAfJPimc+6nVQSraF9A@mail.gmail.com>
On 2024-04-20 21:09:46 -0700, Bart Schaefer wrote:
> > > > But then, why does "kill %%" work?
> > >
> > > It doesn't.
> >
> > Indeed, it doesn't, but %1 works
>
> Except that %1 might be the wrong job number if there are any
> background jobs?
Yes, that's a potential issue, and that's why I would prefer %%.
> Why not do it like this?
>
> setopt TRAPS_ASYNC
> echo $$
> trap 'kill $xterm; exit' TERM
> xterm & xterm=$!
> wait $xterm
> echo end
xterm was just a very simple example. In practice, several commands
are involved, and among them, there are zsh functions that may need
to affect the environment.
--
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