Subject: | Removal dependency on Proc::ProcessTable |
sub _is_running is getting list of all processes in system just to check
if given process exists. There is better way of handling it, and it also
reduces dependencies: we can use kill(0, $pid) to check for process
existence.
It will work on everything except RISC OS, but I don't think that this
system is currently very important.
Anyway - please find attached patch that removes the dependency and
checks for pid with kill(0, $pid).
Subject: | proc-pidfile.patch |
--- Pidfile.pm.orig 2010-04-15 13:42:40.000000000 +0200
+++ Pidfile.pm 2010-04-15 13:44:11.000000000 +0200
@@ -3,7 +3,6 @@
$VERSION = '1.005';
use Fcntl qw( :flock );
use File::Basename qw( basename );
-require Proc::ProcessTable;
require File::Spec;
sub new
@@ -61,9 +60,8 @@
sub _is_running
{
my $pid = shift;
- my $table = Proc::ProcessTable->new()->table;
- my %processes = map { $_->pid => $_ } @$table;
- return exists $processes{$pid};
+ die "This isn't going to work on RISC OS, if you really want a pid file on this system please send me a patch.\n" if 'riscos' eq $^O;
+ return kill(0, $pid);
}
sub _create_pidfile