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

Exit trap is not executed when error occurs in a function



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 }

Is this a bug? I found this in zsh 5.9 (arm64-apple-darwin25.0). If it is a bug, it has been there a while; it reproduces in zsh 4.3.4 (with different syntax for declaring the functions).

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

Attachment: smime.p7s
Description: S/MIME cryptographic signature



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