Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to propagate SIGTERM to the foreground job, if any?
On Fri, Apr 19, 2024 at 2:32 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> On 2024-04-19 13:06:12 -0700, Bart Schaefer wrote:
> >
> > That you have job control at all implies this is an interactive shell.
>
> No, this is a script.
OK.
> > > 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?
Why not do it like this?
setopt TRAPS_ASYNC
echo $$
trap 'kill $xterm; exit' TERM
xterm & xterm=$!
wait $xterm
echo end
Messages sorted by:
Reverse Date,
Date,
Thread,
Author