From: Chris Nehren Date: Fri, 20 Apr 2012 00:27:52 +0000 (-0400) Subject: change signal names to numbers as that is more portable and perl's X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8057fbc4bb13a7aa225ea915523f58b8c2e96de8;p=gitmo%2FMooseX-Daemonize.git change signal names to numbers as that is more portable and perl's kill() supports them anyway so there's no reason *not* to use them --- diff --git a/Changes b/Changes index 6e5c4f2..810912a 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for MooseX-Daemonize +0.14 Thursday April 19, 2012 + - using signal numbers directly is + not portable; use the names instead + since perl's kill() supports them + 0.13 Wed. July 6, 2011 - adding docs related to closing all filehandles and the issues that can diff --git a/Makefile.PL b/Makefile.PL index 98d1409..d73a986 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -16,5 +16,5 @@ requires 'MooseX::Types::Path::Class' => 0; no_index 'directory' => 'examples'; auto_manifest; -auto_repository; +#auto_repository; WriteAll; diff --git a/lib/MooseX/Daemonize.pm b/lib/MooseX/Daemonize.pm index 5c627ba..07a0d9a 100644 --- a/lib/MooseX/Daemonize.pm +++ b/lib/MooseX/Daemonize.pm @@ -3,7 +3,7 @@ use strict; # because Kwalitee is pedantic use Moose::Role; use MooseX::Types::Path::Class; -our $VERSION = '0.13'; +our $VERSION = '0.14'; with 'MooseX::Daemonize::WithPidFile', 'MooseX::Getopt'; @@ -257,7 +257,7 @@ $_kill = sub { # Try SIGINT ... 2s ... SIGTERM ... 2s ... SIGKILL ... 3s ... UNDEAD! my $terminating_signal; - for ( [ 2, $timeout ], [15, $timeout], [9, $timeout * 1.5] ) { + for ( [ 'INT', $timeout ], ['TERM', $timeout], ['KILL', $timeout * 1.5] ) { my ($signal, $timeout) = @$_; $timeout = int $timeout; @@ -276,9 +276,9 @@ $_kill = sub { } if($terminating_signal) { - if($terminating_signal == 9) { - # clean up the pidfile ourselves iff we used -9 and it worked - warn "Had to resort to 'kill -9' and it worked, wiping pidfile"; + if($terminating_signal eq 'KILL') { + # clean up the pidfile ourselves iff we used KILL and it worked + warn "Had to resort to 'kill -KILL' and it worked, wiping pidfile"; eval { $self->pidfile->remove }; if ($@) { warn "Could not remove pidfile ("