From: Andy Grundman Date: Fri, 26 Oct 2007 04:44:42 +0000 (+0000) Subject: Patch from Jon Schutz to add a proper SIGCHLD repear to Engine::HTTP to fix issue... X-Git-Tag: 5.7099_04~113 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=41593b496f3f55861439312779a9465f6a2c6600 Patch from Jon Schutz to add a proper SIGCHLD repear to Engine::HTTP to fix issue with system() returning -1 instead of the correct value --- diff --git a/Changes b/Changes index 45122e6..5e3846e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ # This file documents the revision history for Perl extension Catalyst. -5.7011 +5.7012 + - Fixed Engine::HTTP to use a proper SIGCHLD repear. Should fix issues with + system() calls returning -1 instead of the correct value. (Jon Schutz) + +5.7011 2007-10-18 20:40:00 - Allow multiple restart directories and added option to follow symlinks in the HTTP::Restarter engine (Sebastian Willert) - Fixed t/optional_http-server-restart.t so it actually tests diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index ec4ad86..725992e 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -11,6 +11,7 @@ use NEXT; use Socket; use IO::Socket::INET (); use IO::Select (); +use POSIX ":sys_wait_h"; # For PAR require Catalyst::Engine::HTTP::Restarter; @@ -189,7 +190,7 @@ sub run { } my $restart = 0; - local $SIG{CHLD} = 'IGNORE'; + local $SIG{CHLD} = \&_REAPER; my $allowed = $options->{allowed} || { '127.0.0.1' => '255.255.255.255' }; my $addr = $host ? inet_aton($host) : INADDR_ANY; @@ -525,6 +526,12 @@ sub _socket_data { sub _inet_addr { unpack "N*", inet_aton( $_[0] ) } +sub _REAPER { + my $child; + while ( ( $child = waitpid( -1,WNOHANG ) ) > 0 ) { } + $SIG{CHLD} = \&_REAPER; +} + =head1 SEE ALSO L, L.