We need to capture @ARGV in the restarter, for the benefit of Win32
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 7401e6d..1798995 100644 (file)
@@ -988,7 +988,7 @@ GetOptions(
     'fork|f'              => \$fork,
     'help|?'              => \$help,
     'host=s'              => \$host,
-    'port=s'              => \$port,
+    'port|p=s'            => \$port,
     'keepalive|k'         => \$keepalive,
     'restart|r'           => \$restart,
     'restartdelay|rd=s'   => \$check_interval,
@@ -1031,11 +1031,13 @@ my $runner = sub {
 };
 
 if ( $restart ) {
-    require Catalyst::Restarter;
-
     die "Cannot run in the background and also watch for changed files.\n"
         if $background;
 
+    require Catalyst::Restarter;
+
+    my $subclass = Catalyst::Restarter->pick_subclass;
+
     my %args;
     $args{follow_symlinks} = 1
         if $follow_symlinks;
@@ -1046,9 +1048,10 @@ if ( $restart ) {
     $args{filter} = qr/$file_regex/
         if defined $file_regex;
 
-    my $restarter = Catalyst::Restarter->new(
+    my $restarter = $subclass->new(
         %args,
         start_sub => $runner,
+        argv      => \@argv,
     );
 
     $restarter->run_and_watch;