Changed from try/catch to if(function_exists())

This commit is contained in:
Martin 2015-04-10 09:17:55 +02:00
commit 0cfbf33671

View file

@ -149,17 +149,15 @@ class RawConnection {
return; return;
} }
if ($terminate) { if ($terminate) {
$status = proc_get_status($this->process); // if for case that posix_ functions are not available
$ppid = $status['pid']; if (function_exists('posix_kill')) {
$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); $status = proc_get_status($this->process);
foreach($pids as $pid) { $ppid = $status['pid'];
if(is_numeric($pid)) { $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);
// try for case that posix_ functions are not available foreach($pids as $pid) {
try { if(is_numeric($pid)) {
//9 is the SIGKILL signal //9 is the SIGKILL signal
posix_kill($pid, 9); posix_kill($pid, 9);
} catch (\Exception $e) {
throw $e;
} }
} }
} }