| 1 | kill=$(command -v kill) |
| 2 | |
| 3 | # Why don't other shells run this trap? It's not a subshell |
| 4 | $SH -c 'trap "echo on exit" EXIT; sleep 0.2' & |
| 5 | |
| 6 | sleep 0.1 |
| 7 | |
| 8 | # Note: this is SIGINT, for the KeyboardInterrupt problem |
| 9 | $kill -INT $! |
| 10 | |
| 11 | wait |
| 12 | |
| 13 | echo status=$? |