poe test pidfile fixups, and make default pidbase an absolute path
[gitmo/MooseX-Daemonize.git] / t / 31.with_pid_file_and_poe.t
index 740090f..ae1c201 100644 (file)
@@ -25,6 +25,8 @@ my $PIDFILE            = catfile($CWD, 'test-app.pid');
 $ENV{MX_DAEMON_STDOUT} = catfile($CWD, 'Out.txt');
 $ENV{MX_DAEMON_STDERR} = catfile($CWD, 'Err.txt');
 
+unlink $PIDFILE; # clean up anythinf leftover by last run
+
 {
     package MyFooDaemon;
     use Moose;
@@ -63,6 +65,7 @@ $ENV{MX_DAEMON_STDERR} = catfile($CWD, 'Err.txt');
             },
             terminate => sub {
               my ($kernel, $heap) = @_[KERNEL, HEAP];
+              $self->pidfile->remove if $self->pidfile->pid == $$;
             }
           },
           heap => [ 0 ]