Last active
November 4, 2019 01:49
-
-
Save lox/ba545dff29ff2fa1f027010ecec4d65b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
terminate(){ | |
printf "Terminating child process $$ after signal." | |
exit 1 | |
} | |
printf "Running $0, pid is %d, pgid is %d\n" "$$" "$(ps -o pgid= $$)" | |
trap 'echo "Got an INT signal"; terminate' INT | |
trap 'echo "Got a TERM signal"; terminate' TERM | |
trap 'echo "Got a QUIT signal"; terminate' QUIT | |
trap 'echo "Got a HUP signal"; terminate' HUP | |
pstree -p $$ | |
sleep 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
terminate(){ | |
printf "Terminating parent process $$ after signal." | |
exit 1 | |
} | |
printf "Running $0, pid is %d, pgid is %d\n" "$$" "$(ps -o pgid= $$)" | |
trap 'echo "Got an INT signal"; terminate' INT | |
trap 'echo "Got a TERM signal"; terminate' TERM | |
trap 'echo "Got a QUIT signal"; terminate' QUIT | |
trap 'echo "Got a HUP signal"; terminate' HUP | |
bash ./child.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- label: "Testing implicit shell" | |
commands: | |
#- trap "kill -- -\$\$" TERM | |
- chmod +x ./parent.sh | |
- ./parent.sh | |
- true | |
- label: "Testing explicit shell" | |
command: ./parent.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment