Skip to content

Instantly share code, notes, and snippets.

@oodler577
Created April 23, 2021 15:09
Show Gist options
  • Save oodler577/7d35afce6af241fa10f8db6f59ccccce to your computer and use it in GitHub Desktop.
Save oodler577/7d35afce6af241fa10f8db6f59ccccce to your computer and use it in GitHub Desktop.
not trapping signal not sure why, ^C, kill -9, etc
#!/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