avoid unnecessary call to kill if kid already died
Jonathan Rockway [Tue, 12 May 2009 00:35:11 +0000 (19:35 -0500)]
lib/MooseX/Runnable/Invocation/Plugin/Restart/Base.pm

index 13c8175..9d516db 100644 (file)
@@ -40,7 +40,11 @@ around 'run' => sub {
     my ($next, $self, @args) = @_;
     my $pid = fork();
     if($pid){
-        local $SIG{CHLD} = 'IGNORE';
+        local $SIG{CHLD} = sub {
+            # handle the case where the child dies unexpectedly
+            waitpid $self->child_pid, 0;
+            $self->clear_child_pid;
+        };
 
         # parent
         $self->child_pid( $pid );