From ebb7ac9673f656065f818919acb39e25e1877884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 9 Dec 2021 17:01: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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kiri-engine/FileListen/HotReload.php b/kiri-engine/FileListen/HotReload.php index 92502752..a2b47b84 100644 --- a/kiri-engine/FileListen/HotReload.php +++ b/kiri-engine/FileListen/HotReload.php @@ -14,6 +14,7 @@ use Swoole\Process; use Swoole\Timer; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -54,7 +55,8 @@ class HotReload extends Command */ protected function configure() { - $this->setName('sw:wather')->setDescription('server start'); + $this->setName('sw:wather')->setDescription('server start') + ->addOption('daemon', null, InputOption::VALUE_OPTIONAL, "是否后台运行", "--front"); } @@ -134,7 +136,9 @@ class HotReload extends Command $this->initCore(); $this->trigger_reload(); - + if ($input->getOption('') == '--daemon') { + Process::daemon(true, true); + } Timer::tick(1000, fn() => $this->healthCheck()); Process::signal(SIGTERM, [$this, 'onSignal']);