Denys Vlasenko | 3ced804 | 2020-02-21 02:55:53 +0100 | [diff] [blame] | 1 | # "exit" in trap should not use last command's exitcode, |
2 | # but exitcode on entering the trap. | ||||
3 | # Nested trap should not interfere with this. | ||||
4 | $THIS_SH -c ' | ||||
5 | trap "echo INT" int | ||||
6 | trap "kill -int $$;exit" term | ||||
7 | kill $$ & | ||||
Denys Vlasenko | 9aa751b | 2020-02-26 09:05:52 +0100 | [diff] [blame] | 8 | (sleep 1; exit 42) |
Denys Vlasenko | 3ced804 | 2020-02-21 02:55:53 +0100 | [diff] [blame] | 9 | ' |
10 | echo 42:$? |