From 681eca4d4baff8969b2f1983a463533765589e95 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 25 Mar 2012 23:29:33 +0000 Subject: (check_pid) simplify using MDK::Common --- lib/Iurt/Process.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/Iurt/Process.pm') diff --git a/lib/Iurt/Process.pm b/lib/Iurt/Process.pm index b7b2f5e..310647f 100644 --- a/lib/Iurt/Process.pm +++ b/lib/Iurt/Process.pm @@ -43,9 +43,7 @@ sub check_pid { if (-f $pidfile) { my (@stat) = stat $pidfile; - open(my $test_PID, $pidfile); - my $pid = <$test_PID>; - close $test_PID; + my $pid = cat_($pidfile); if (!$pid) { plog('ERROR', "ERROR: invalid pidfile ($pid), should be "); @@ -78,11 +76,8 @@ sub check_pid { } } - open my $PID, ">$pidfile" - or die "FATAL: can't open pidfile $pidfile for writing"; + output($pidfile, $$); - print $PID $$; - close $PID; $pidfile; } -- cgit v1.2.1