From 0f172ae62df6ccd6cd565bf80f4a2d789ef88b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 19 Nov 2021 10:40:49 +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 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index 25ed7c29..4c5733dc 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -124,8 +124,6 @@ class HotReload extends Command } - - /** * 重启 * @@ -139,14 +137,11 @@ class HotReload extends Command Process::kill($pid, SIGTERM); } Process::wait(true); - if (!$this->process) { - $this->process = new Process(function (Process $process) { - $process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]); - }); - $this->process->start(); - } else { - $this->process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]); - } + $this->process?->exit(); + $this->process = new Process(function (Process $process) { + $process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]); + }); + $this->process->start(); }