From b0ef09fd359d0845d51785d08400a0c9013d46a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 6 Dec 2021 14:38:06 +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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index 16d90fb9..86368ef7 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -60,6 +60,7 @@ class HotReload extends Command /** * @throws ConfigException * @throws \ReflectionException + * @throws Exception */ protected function initCore() { @@ -70,6 +71,10 @@ class HotReload extends Command } else { $this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]); } + if (file_exists(storage('.manager.pid'))) { + Process::kill(file_get_contents((int)storage('.manager.pid'))); + } + file_put_contents(storage('.manager.pid'), getmypid()); if (Kiri::getPlatform()->isLinux()) { swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather'); } @@ -124,6 +129,7 @@ class HotReload extends Command if (!$data) { return; } + Timer::clearAll(); $this->driver->clear(); $this->stopServer(); $this->stopManager();