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

BUG: Exit trap is not executed when error occurs in a function



I sent email about the issue below several weeks ago and have not seen any acknowledgement or other response. From https://sourceforge.net/p/zsh/bugs/ and https://zsh.sourceforge.io/FAQ/zshfaq06.html, I thought email here is the way to report bugs. If it is just going to vanish into the wind, so be it—I understand zsh is maintained on a volunteer basis. But if I am missing some bug-reporting procedure or I am mistaken about it being a bug, please let me know. (I have also reported it to Apple, FB25342803.)

Here is the issue:

When the ERR_EXIT option (-e) is set and an error occurs in a function, the exit function is not called. Here is a script to demonstrate:

#!/bin/zsh -ef
TRAPEXIT() { echo "This should be printed but is not." }
() { false }

I found this in zsh 5.9 (arm64-apple-darwin25.0).

				— edp (Eric Postpischil)
				https://edp.org




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