Created
April 23, 2021 15:09
-
-
Save oodler577/7d35afce6af241fa10f8db6f59ccccce to your computer and use it in GitHub Desktop.
not trapping signal not sure why, ^C, kill -9, etc
This file contains hidden or 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/perl -w | |
$| = 1; | |
use sigtrap 'handler' => \&sigtrap, 'HUP', 'INT','ABRT','QUIT','TERM'; # ^C, etc | |
while(1){ | |
print "Working...\n"; | |
sleep(2); | |
} | |
sub sigtap(){ | |
print "Caught a signal\n"; | |
exit(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment