change signal names to numbers as that is more portable and perl's
[gitmo/MooseX-Daemonize.git] / lib / MooseX / Daemonize.pm
index 5c627ba..07a0d9a 100644 (file)
@@ -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 ("