From: Jonathan Rockway Date: Tue, 12 May 2009 00:35:11 +0000 (-0500) Subject: avoid unnecessary call to kill if kid already died X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Runnable.git;a=commitdiff_plain;h=c15146cc17e816af2b989a8585b5c987bb82860b avoid unnecessary call to kill if kid already died --- diff --git a/lib/MooseX/Runnable/Invocation/Plugin/Restart/Base.pm b/lib/MooseX/Runnable/Invocation/Plugin/Restart/Base.pm index 13c8175..9d516db 100644 --- a/lib/MooseX/Runnable/Invocation/Plugin/Restart/Base.pm +++ b/lib/MooseX/Runnable/Invocation/Plugin/Restart/Base.pm @@ -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 );