From 3bcecef5df0245df693a19c615d4842fc9d0f3d0 Mon Sep 17 00:00:00 2001 From: dqos <8611981+dqos@users.noreply.github.com> Date: Thu, 14 Apr 2022 12:12:50 +0200 Subject: [PATCH] Fix for Debian in Docker. --- LookingGlass.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/LookingGlass.php b/LookingGlass.php index 9f28782..043b651 100644 --- a/LookingGlass.php +++ b/LookingGlass.php @@ -311,14 +311,16 @@ class LookingGlass foreach ($pipes as $pipe) { fclose($pipe); } - // retrieve parent pid - $ppid = $status['pid']; - // use ps to get all the children of this process - $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`); - // kill remaining processes - foreach($pids as $pid) { - if (is_numeric($pid)) { - posix_kill($pid, 9); + if ($status['pid']) { + // retrieve parent pid + //$ppid = $status['pid']; + // use ps to get all the children of this process + $pids = preg_split('/\s+/', 'ps -o pid --no-heading --ppid '.$status['pid']); + // kill remaining processes + foreach ($pids as $pid) { + if (is_numeric($pid)) { + posix_kill($pid, 9); + } } } proc_close($process);