busybox/shell/hush_test/hush-signals/signal9.tests
Denys Vlasenko 9fda609a60 hush: add support for "set -e"
function                                             old     new   delta
run_list                                             978    1046     +68
o_opt_strings                                         24      32      +8
reset_traps_to_defaults                              136     142      +6
pick_sighandler                                       57      60      +3
packed_usage                                       31772   31770      -2
hush_main                                            983     961     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 85/-24)             Total: 61 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14 13:36:48 +02:00

22 lines
418 B
Plaintext
Executable File

# Note: the inner script is a test which checks for a different bug
# (ordering between INT handler and exit on "set -e"),
# but so far I did not figure out how to simulate it non-interactively.
"$THIS_SH" -c '
exit_func() {
echo "Removing traps"
trap - EXIT TERM INT
echo "End of exit_func"
}
set -e
trap exit_func EXIT TERM INT
sleep 2
exit 77
' &
child=$!
sleep 1
kill -TERM $child
wait
echo Done: $?