From bcf73a8cadf721a7a33665d0bb8a1e154991017c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 19 Nov 2021 11:05:08 +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 --- kiri-engine/FileListen/HotReload.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index 5d75c975..ef7cccaa 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -140,12 +140,12 @@ class HotReload extends Command public function trigger_reload() { $this->logger->warning('change reload'); -// $pid = file_get_contents(storage('.swoole.pid')); -// if (!empty($pid) && Process::kill($pid, 0)) { -// Process::kill($pid, SIGTERM); -// } - if ($this->process instanceof Process) { - $this->process->exit(); + $pid = file_get_contents(storage('.swoole.pid')); + if (!empty($pid) && Process::kill($pid, 0)) { + Process::kill($pid, SIGTERM); + } + if ($this->process && Process::kill($this->process->pid,0)) { + Process::kill($this->process->pid) && Process::wait(true); } $this->process = new Process(function (Process $process) { $process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]);