Last active
August 29, 2015 13:59
-
-
Save coderjoe/10660379 to your computer and use it in GitHub Desktop.
Test subprocess sighup handling
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
run the bash script with: | |
./test.sh & | |
run the node script with: | |
node ./test.js >> logfile.txt & | |
Kill either with: | |
kill -1 <pid> | |
or | |
kill -s SIGHUP <pid> |
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
setInterval(function() { | |
console.log("Still going!"); | |
},1000); |
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
#!/usr/bin/env bash | |
rm ~/log.txt | |
touch ~/log.txt | |
clean_sighup() { | |
echo "Cleanly handling SIGHUP" >> ~/log.txt | |
exit | |
} | |
trap clean_exit SIGHUP | |
while true | |
do | |
echo "Still going!" >> ~/log.txt | |
sleep 3s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment