From 0007242b70de279648e6f6f4c3d8465f4418f906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 6 Dec 2021 14:40:18 +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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index debcdbab..7d6fb7b4 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -72,7 +72,10 @@ class HotReload extends Command $this->driver = Kiri::getDi()->make(Inotify::class, [$this->dirs, $this]); } if (file_exists(storage('.manager.pid'))) { - Process::kill((int)file_get_contents(storage('.manager.pid')), -15); + $pid = (int)file_get_contents(storage('.manager.pid')); + if ($pid > 0 && Process::kill($pid, 0)) { + Process::kill($pid, -15); + } } file_put_contents(storage('.manager.pid'), getmypid()); if (Kiri::getPlatform()->isLinux()) {