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

Re: How to trap EXIT like in bash



* Bart Schaefer (Sat, 4 Apr 2015 13:25:28 -0700)
> 
> On Apr 4,  9:41pm, Thorsten Kampe wrote:
> }
> } >     zshexit() { echo trapped }
> } >     trap exit HUP INT TERM
> } 
> } As stated to Philippe: this works in regard to exit and INT, but not 
> } for HUP and TERM. The script ignores any `kill PID` request.
> } 
> } Tested on Cygwin and Ubuntu 14.10.
> 
> Oh.  You need "setopt TRAPS_ASYNC":

Confirming that setting this options makes a Zsh script terminate and 
execute the specified traps.

Thorsten



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