blob: 045294bf45ab448af2e7d04d4b4f6282e99b1c38 [file] [log] [blame]
Denys Vlasenko67f71862009-09-25 14:21:06 +02001# Non-empty traps should be reset in subshell
2
3# HUP is special in interactive shells
4trap '' HUP
5# QUIT is always special
6trap '' QUIT
7# SYS is not special
8trap '' SYS
9# WINCH is harmless
10trap 'bad: caught WINCH' WINCH
11# With TERM we'll check whether it is reset
12trap 'bad: caught TERM' TERM
13
Denys Vlasenko3a7034c2009-09-30 02:48:59 +020014# using bash, because we don't have $PPID (yet)
Denys Vlasenkoe89a2412010-01-12 15:19:31 +010015(trap; bash -c 'kill -HUP $PPID'; echo Ok)
16(trap; bash -c 'kill -QUIT $PPID'; echo Ok)
17(trap; bash -c 'kill -SYS $PPID'; echo Ok)
18(trap; bash -c 'kill -WINCH $PPID'; echo Ok)
19(trap; bash -c 'kill -TERM $PPID'; echo Bad: TERM is not reset)
Denys Vlasenko67f71862009-09-25 14:21:06 +020020echo Done