From db3bc33aa3c295ec693b666b9330015e3b97127e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 1 Mar 2021 15:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Action.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/HttpServer/Action.php b/HttpServer/Action.php index 96b16c72..622db125 100644 --- a/HttpServer/Action.php +++ b/HttpServer/Action.php @@ -50,19 +50,16 @@ trait Action */ private function _shutdown($server) { - $content = file_get_contents($this->getPidFile()); - if (!file_exists($content)) { + $pid_file = $this->getPidFile(); + if (!file_exists($pid_file)) { return; } - if (empty($content)) { - $this->close($server); - } else { - exec("ps -ef $content | grep $content", $output); - if (!empty($output)) { - exec("kill -15 $content"); - } - $this->close($server); + $content = file_get_contents($pid_file); + exec("ps -ef $content | grep $content", $output); + if (!empty($output)) { + exec("kill -15 $content"); } + $this->close($server); }