diff options
Diffstat (limited to 'regress/bin/ksh')
-rw-r--r-- | regress/bin/ksh/trap.t | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/regress/bin/ksh/trap.t b/regress/bin/ksh/trap.t index 624f37af902..bdef549c4bc 100644 --- a/regress/bin/ksh/trap.t +++ b/regress/bin/ksh/trap.t @@ -1,4 +1,4 @@ -# $OpenBSD: trap.t,v 1.1 2022/10/10 14:57:48 kn Exp $ +# $OpenBSD: trap.t,v 1.2 2022/10/14 22:56:13 kn Exp $ # # Check that I/O redirection failure triggers the ERR trap. @@ -47,3 +47,37 @@ expected-stderr-pattern: /Is a directory/ expected-exit: e != 0 --- + +# +# Check that the errexit option does not interfere with running traps. +# + +name: EXIT-always-runs +description: + Check that the EXIT trap runs under errexit even if the ERR trap failed. +arguments: !-e! +stdin: + trap 'echo ERR ; false' ERR + trap 'echo EXIT' EXIT + false +expected-stdout: + ERR + EXIT +expected-exit: e != 0 +--- + + +name: signal-handling-is-no-error +description: + Check that gracefully handling a signal is not treated as error. +arguments: !-e! +stdin: + trap 'echo ERR' ERR + trap 'echo EXIT' EXIT + trap 'echo USR1' USR1 + kill -USR1 $$ +expected-stdout: + USR1 + EXIT +expected-exit: e == 0 +--- |