X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=332e771aaacbd4733612af99cd952b6090d70dd9;hb=5d1266aecbc3b839f0b904093ccf282a73e06c91;hp=e056ffff1d2380ca3652fc7d928f0d0c244ef717;hpb=bd357f391bf8e0df526773dc2555127f1cc9e331;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index e056fff..332e771 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -113,12 +113,6 @@ sub run { $options ||= {}; - our $GOT_HUP; - local $GOT_HUP = 0; - - local $SIG{HUP} = sub { $GOT_HUP = 1; }; - local $SIG{CHLD} = 'IGNORE'; - # Setup restarter my $restarter; if ( $options->{restart} ) { @@ -135,7 +129,11 @@ sub run { my $regex = $options->{restart_regex}; my $one = _index( $dir, $regex ); RESTART: while (1) { - sleep $options->{restart_delay}; + sleep $options->{restart_delay} || 1; + + # check if our parent has died + exit if ( getppid == 1 ); + my $two = _index( $dir, $regex ); my $changes = _compare_index( $one, $two ); if (@$changes) { @@ -163,6 +161,12 @@ sub run { } } } + + our $GOT_HUP; + local $GOT_HUP = 0; + + local $SIG{HUP} = sub { $GOT_HUP = 1; }; + local $SIG{CHLD} = 'IGNORE'; # Handle requests