From 35c675b30863bce60eaa0bffcb2725d3c52e7ab0 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 7 Aug 2008 07:29:39 +0000 Subject: (is_running) make it return the actual PID of the first found process rather than a boolean --- perl-install/common.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/perl-install/common.pm b/perl-install/common.pm index 2924c4cb7..2234c0e91 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -303,10 +303,10 @@ sub set_permissions { sub is_running { my ($name, $o_user) = @_; my $user = $o_user || $ENV{USER}; - any { + foreach (`ps -o '%P %p %c' -u $user`) { my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/; - $ppid != 1 && $pid != $$ && $n eq $name; - } `ps -o '%P %p %c' -u $user`; + return $pid if $ppid != 1 && $pid != $$ && $n eq $name; + } } sub parse_release_file { -- cgit v1.2.1