busybox/shell/hush_test/hush-misc/exitcode_trap6.tests
Denys Vlasenko 9aa751b08a shells: fix exitcode_trapN tests to avoid races
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-26 09:05:52 +01:00

11 lines
250 B
Plaintext
Executable File

# "exit" in trap should not use last command's exitcode,
# but exitcode on entering the trap.
# Nested trap should not interfere with this.
$THIS_SH -c '
trap "echo INT" int
trap "kill -int $$;exit" term
kill $$ &
(sleep 1; exit 42)
'
echo 42:$?