signal2.tests 256 B

123456789101112131415161718
  1. #!/bin/sh
  2. $THIS_SH -c '
  3. cleanup() {
  4. echo "child exits as expected"
  5. exit
  6. }
  7. trap cleanup HUP
  8. echo "child sleeps"
  9. sleep 1
  10. echo "BAD exit from child!"
  11. ' &
  12. child=$!
  13. sleep 0.1 # let child install handler first
  14. kill -HUP $child
  15. wait
  16. echo "parent exits"