summaryrefslogtreecommitdiffhomepage
path: root/tests/zash/errtrap-exec.sh
blob: 3acf6e116c729a825e147e19586ff92efa8f52d4 (plain)
1
2
3
4
5
6
7
8
# The ERR trap runs for the last command too.  A failing external command
# as the last thing a shell runs is exec'd, and the shell is gone before
# the trap could run, unless the trap holds that shortcut back.  So does a
# subshell that would otherwise run in the parent.
"$TSH" -c 'trap "echo ERR" ERR; /bin/false'; echo "[$?]"
"$TSH" -c 'trap "echo ERR" ERR; false'; echo "[$?]"
"$TSH" -c 'trap "echo ERR" ERR; (/bin/false)'; echo "[$?]"
"$TSH" -c 'trap "echo ERR" ERR; trap "echo BYE" EXIT; /bin/false'; echo "[$?]"