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

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



On Sun, Apr 21, 2024 at 4:59 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> You can see additional details in the bug I had reported several
> months ago:
>
>   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052451
>
> but after some reflection and finding the issue with the timeout,
> I think that the real bug is in my script, which should kill the
> current job and itself when receiving SIGTERM.

So really what we're searching for here is a workaround for a bug in a
different application that happens to be executing a zsh script.

Try this:
  trap 'setopt MONITOR HUP NOCHECKJOBS; exit' TERM

That won't kill an xterm process because xterm ignores SIGHUP, but it
should kill ssh-add.

>   ssh-add file1 file2 file3 &
>
> ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
> ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
> ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory

That's ... interesting.  The error makes it look like ssh-askpass is
what's not being found, but it's probably choking trying to open a
terminal.  I can think of some possible ways to fake it but perhaps
with the above MONITOR tweak it isn't necessary.




Messages sorted by: Reverse Date, Date, Thread, Author