<feed xmlns='http://www.w3.org/2005/Atom'>
<title>zash.git/tests/zash/errtrap-exec.sh, branch main</title>
<subtitle>Fast Almquist-family POSIX shell for z/OS UNIX with bundled libedit</subtitle>
<id>https://git.abendless.com/zash.git/atom?h=main</id>
<link rel='self' href='https://git.abendless.com/zash.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/'/>
<updated>2026-11-28T06:18:38Z</updated>
<entry>
<title>fix(exec): run the ERR trap when the last command is exec'd</title>
<updated>2026-11-28T06:18:38Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:18:38Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=9cdf5f548dc8e1d5c6315b304819bf0fd60f802f'/>
<id>urn:sha1:9cdf5f548dc8e1d5c6315b304819bf0fd60f802f</id>
<content type='text'>
`trap "echo ERR" ERR; /bin/false` printed nothing: the shell replaced
itself with the failing program and was gone before the trap could run.
The same shortcut made `trap ... ; (/bin/false)` silently skip it.

trap_after_last() is true when the EXIT or the ERR trap is set, and both
the exec shortcut in run_external() and the in-process subshell shortcut
in eval_subshell() now use it instead of trap_has_exit().

tests/zash/errtrap-exec.sh covers the external command, a builtin, a
subshell and the two traps together; the first and third lines fail
without the change.  ksh93 prints ERR for all four.
</content>
</entry>
</feed>
