From 78fdc7c1cac4b997dcd845fa9acb777df3051ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 18 Nov 2021 16:38:43 +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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index ab7a2de3..7ff5664b 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -114,10 +114,14 @@ class HotReload extends Command public function trigger_reload() { Kiri::getDi()->get(Logger::class)->warning('change reload'); - - $this->stop(); Coroutine::create(function () { - $this->source = proc_open("php " . APP_PATH . "kiri.php", [], $pipes); + $source = proc_open("php " . APP_PATH . "kiri.php start", [], $pipes); + $pid = file_get_contents(storage('.swoole.pid')); + if (!empty($pid)) { + Process::kill($pid, SIGTERM); + } + $this->stop(); + $this->source = $source; }); }