Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mojolicious CPAN distribution.

Report information
The Basics
Id: 61231
Status: resolved
Priority: 0/
Queue: Mojolicious

People
Owner: Nobody in particular
Requestors: adamk [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Daemon fails to clean up PID file on Windows
Download (untitled) / with headers
text/plain 708b
The following code breaks when trying to start the daemon after a crash. On Windows, an open file creates a file lock. Because Mojo never closes the PID file handle, the unlink will fail. You need to make sure you close your filehandles when you are finished with them. sub prepare_pid_file { my $self = shift; return unless my $file = $self->pid_file; # PID file my $fh; if (-e $file) { $fh = IO::File->new("< $file") or croak qq/Can't open PID file "$file": $!/; my $pid = <$fh>; warn "Server already running with PID $pid.\n" if kill 0, $pid; warn qq/Can't unlink PID file "$file".\n/ unless -w $file && unlink $file; }
Fixed already on GitHub.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.