Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: using trap function to cleanup and exit?
Hi Peter,
I thought I'd changed that last night when I was reading that section
of the manual, when I changed the exit value 1 to $(( 128 + $1 )), but
apparently not.
That does seem to be working better, in that the script itself does
exit after running the cleanup, but the child sleep process still
remains.
I am playing with 'kill -9 -$$' in the trap function, but that seems
like an awfully large hammer.
thank you,
Greg
>>>>> On April 10, 2022 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sun, 2022-04-10 at 11:46 -0400, Greg Klanderman wrote:
>> TRAPTERM () {
>> echo "in TRAPTERM"
>> cleanup TERM
>> exit $(( 128 + $1 ))
>> }
> I haven't gone through this in great detail, so no guarantee this causes
> everything to spring into life, but just to note that normal service
> here would be obtained if you turn that "exit" into "return". As
> described in the Trap Functions in zshmisc, that's specially handled so
> that the shell knows you want to continue to exit in a similar way to if
> SIGTERM had been received without the trap function.
> pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author