Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to propagate SIGTERM to the foreground job, if any?



On 2024-04-21 19:29:09 +0200, Vincent Lefevre wrote:
> On 2024-04-20 21:09:46 -0700, Bart Schaefer wrote:
> > 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.

Moreover, a Ctrl-C in the terminal doesn't seem to be handled
correctly (here, ssh-add with several files in argument is executed
via zsh functions, but it refuses to quit on Ctrl-C).

-- 
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