[Catalyst-commits] r11460 - in Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst: . Restarter

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Oct 5 22:11:21 GMT 2009


Author: t0m
Date: 2009-10-05 22:11:21 +0000 (Mon, 05 Oct 2009)
New Revision: 11460

Modified:
   Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter.pm
   Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Forking.pm
   Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Win32.pm
Log:
Fix the restarter in devel branch hopefully

Modified: Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Forking.pm
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Forking.pm	2009-10-05 22:01:06 UTC (rev 11459)
+++ Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Forking.pm	2009-10-05 22:11:21 UTC (rev 11460)
@@ -1,10 +1,7 @@
 package Catalyst::Restarter::Forking;
+
 use Moose;
 
-use threads;
-use Thread::Cancel;
-use namespace::autoclean;
-
 extends 'Catalyst::Restarter';
 
 has _child => (
@@ -31,9 +28,12 @@
 
     return unless kill 0, $self->_child;
 
-    local $SIG{CHLD} = 'IGNORE';
     die "Cannot send INT signal to ", $self->_child, ": $!"
         unless kill 'INT', $self->_child;
+    # If we don't wait for the child to exit, we could attempt to
+    # start a new server before the old one has given up the port it
+    # was listening on.
+    wait;
 }
 
 1;

Modified: Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Win32.pm
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Win32.pm	2009-10-05 22:01:06 UTC (rev 11459)
+++ Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter/Win32.pm	2009-10-05 22:11:21 UTC (rev 11460)
@@ -1,7 +1,7 @@
 package Catalyst::Restarter::Win32;
+
 use Moose;
 use Proc::Background;
-use namespace::autoclean;
 
 extends 'Catalyst::Restarter';
 
@@ -16,7 +16,7 @@
 
     # This is totally hack-tastic, and is probably much slower, but it
     # does seem to work.
-    my @command = ( $^X, $0, grep { ! /^\-r/ } @ARGV );
+    my @command = ( $^X, map("-I$_", @INC), $0, grep { ! /^\-r/ } @{ $self->argv } );
 
     my $child = Proc::Background->new(@command);
 

Modified: Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter.pm
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter.pm	2009-10-05 22:01:06 UTC (rev 11459)
+++ Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Restarter.pm	2009-10-05 22:11:21 UTC (rev 11460)
@@ -1,10 +1,11 @@
 package Catalyst::Restarter;
+
 use Moose;
 
 use Cwd qw( abs_path );
 use File::ChangeNotify;
 use FindBin;
-use namespace::autoclean;
+use namespace::clean -except => 'meta';
 
 has start_sub => (
     is       => 'ro',
@@ -12,6 +13,12 @@
     required => 1,
 );
 
+has argv =>  (
+    is       => 'ro',
+    isa      => 'ArrayRef',
+    required => 1,
+);
+
 has _watcher => (
     is  => 'rw',
     isa => 'File::ChangeNotify::Watcher',
@@ -47,7 +54,7 @@
 
     delete $p->{start_sub};
 
-    $p->{filter} ||= qr/(?:\/|^)(?!\.\#).+(?:\.yml$|\.yaml$|\.conf|\.pm)$/;
+    $p->{filter} ||= qr/(?:\/|^)(?![.#_]).+(?:\.yml$|\.yaml$|\.conf|\.pm)$/;
     $p->{directories} ||= abs_path( File::Spec->catdir( $FindBin::Bin, '..' ) );
 
     # We could make this lazily, but this lets us check that we




More information about the Catalyst-commits mailing list