From 4e7a51a51e3444b9679fe619449745d04aabfaed Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 29 Mar 2006 22:05:42 +0000 Subject: (is_running) return the actual pid of the found program --- mdkonline.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mdkonline.pm') diff --git a/mdkonline.pm b/mdkonline.pm index 09296d1b..6674a2e8 100644 --- a/mdkonline.pm +++ b/mdkonline.pm @@ -345,10 +345,15 @@ sub write_wide_conf { sub is_running { my ($name) = @_; - any { + my $found; + foreach (`ps -o '%P %p %c' -u $ENV{USER}`) { my ($_ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/; - $pid != $$ && $n eq $name; - } `ps -o '%P %p %c' -u $ENV{USER}`; + if ($pid != $$ && $n eq $name) { + $found = $pid; + last; + } + } + $found; } # Romain: you need to finish those dns functions or drop them -- cgit v1.2.1