From 47f140711877d564503c7f2704061b09f447a009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 19 Nov 2021 11:21:02 +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, 5 insertions(+), 5 deletions(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index dc7190fb..2ba78ee1 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -10,7 +10,6 @@ use Kiri\Exception\ConfigException; use Kiri\Kiri; use Swoole\Coroutine; use Swoole\Process; -use Swoole\Runtime; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -91,19 +90,21 @@ class HotReload extends Command } - /** * @param $data * @throws Exception */ public function onSignal($data) { + if (!$data) { + return; + } $this->driver->clear(); $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)) { + if ($this->process && Process::kill($this->process->pid, 0)) { Process::kill($this->process->pid) && Process::wait(true); } while ($ret = Process::wait(true)) { @@ -129,7 +130,6 @@ class HotReload extends Command } - /** * 重启 * @@ -142,7 +142,7 @@ class HotReload extends Command // if (!empty($pid) && Process::kill($pid, 0)) { // Process::kill($pid, SIGTERM); // } - if ($this->process && Process::kill($this->process->pid,0)) { + if ($this->process && Process::kill($this->process->pid, 0)) { Process::kill($this->process->pid) && Process::wait(true); } $this->process = new Process(function (Process $process) {