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

Re: [Bug] Exiting shell from function called by trap handler always produces status 0



Peter Stephenson wrote on Tue, 09 Oct 2018 21:09 +0100:
> Here's a slight improvement --- we can "exit 0" even if the last command
> status is non-zero.

Can we add a test for this?  I tried to write one but couldn't nail down
the behaviour that differed.

FWIW:

% Src/zsh -fc 'fn() { exit 0 }; trap fn EXIT; false'  ; echo $?
1
% /usr/bin/zsh -fc 'fn() { exit 0 }; trap fn EXIT; false' ; echo $?
0
% 



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