From: Brandon L Black Date: Mon, 28 Jan 2008 04:33:11 +0000 (+0000) Subject: poe test pidfile fixups, and make default pidbase an absolute path X-Git-Tag: 0.15~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Daemonize.git;a=commitdiff_plain;h=b38ab84f7a1b83212eefcb2e7f876c42b8dbfb24 poe test pidfile fixups, and make default pidbase an absolute path --- diff --git a/Changes b/Changes index ed9f4ae..3493290 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for MooseX-Daemonize + * MooseX::Daemonize + - Made default pidbase '/var/run' rather than './var/run' + - Small fixups to pidfile testing in t/31.with_pid_file_and_poe.t + 0.06 Fri. Dec. 21, 2007 * MooseX::Daemonize - Fix logic that kills process so it doens't always warn diff --git a/lib/MooseX/Daemonize.pm b/lib/MooseX/Daemonize.pm index 4329d5d..ba46d4d 100644 --- a/lib/MooseX/Daemonize.pm +++ b/lib/MooseX/Daemonize.pm @@ -30,7 +30,7 @@ has pidbase => ( coerce => 1, required => 1, lazy => 1, - default => sub { Path::Class::Dir->new('var', 'run') }, + default => sub { Path::Class::Dir->new('', 'var', 'run') }, ); has basedir => ( diff --git a/t/31.with_pid_file_and_poe.t b/t/31.with_pid_file_and_poe.t index 740090f..ae1c201 100644 --- a/t/31.with_pid_file_and_poe.t +++ b/t/31.with_pid_file_and_poe.t @@ -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 ]