From c66e5120e145990099c0a2b02065e4f1c7d9ecbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 18 Nov 2021 17:55:52 +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 68d78d6e..2ba52911 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -7,6 +7,7 @@ use Kiri\Abstracts\Config; use Kiri\Abstracts\Logger; use Kiri\Exception\ConfigException; use Kiri\Kiri; +use Server\Constant; use Swoole\Coroutine; use Swoole\Process; use Symfony\Component\Console\Command\Command; @@ -132,6 +133,11 @@ class HotReload extends Command { Kiri::getDi()->get(Logger::class)->warning('change reload'); Coroutine::create(function () { + $reusePort = Config::get('server.settings')[Constant::OPTION_ENABLE_REUSE_PORT] ?? false; + if (!$reusePort) { + $this->source = proc_open("php " . APP_PATH . "kiri.php sw:server", [], $pipes); + return; + } $pid = file_get_contents(storage('.swoole.pid')); $source = proc_open("php " . APP_PATH . "kiri.php sw:server start", [], $pipes); if (!empty($pid) && Process::kill($pid, 0)) {