From 0cfbf3367133ed63fb2a1796738ba4efb764ca28 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 10 Apr 2015 09:17:55 +0200 Subject: [PATCH] Changed from try/catch to if(function_exists()) --- src/RawConnection.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/RawConnection.php b/src/RawConnection.php index 89728a4..1547851 100644 --- a/src/RawConnection.php +++ b/src/RawConnection.php @@ -149,17 +149,15 @@ class RawConnection { return; } if ($terminate) { - $status = proc_get_status($this->process); - $ppid = $status['pid']; - $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); - foreach($pids as $pid) { - if(is_numeric($pid)) { - // try for case that posix_ functions are not available - try { + // if for case that posix_ functions are not available + if (function_exists('posix_kill')) { + $status = proc_get_status($this->process); + $ppid = $status['pid']; + $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); + foreach($pids as $pid) { + if(is_numeric($pid)) { //9 is the SIGKILL signal posix_kill($pid, 9); - } catch (\Exception $e) { - throw $e; } } }