From a7024843d346f655a65a241c298c2773ab8eefab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 4 Nov 2021 16:45:40 +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/FileChangeCustomProcess.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kiri-engine/FileListen/FileChangeCustomProcess.php b/kiri-engine/FileListen/FileChangeCustomProcess.php index 1e1ca03e..1428fc39 100644 --- a/kiri-engine/FileListen/FileChangeCustomProcess.php +++ b/kiri-engine/FileListen/FileChangeCustomProcess.php @@ -7,6 +7,7 @@ use Kiri\Abstracts\Config; use Kiri\Abstracts\Logger; use Kiri\Exception\ConfigException; use Kiri\Kiri; +use Swoole\Coroutine; use Swoole\Coroutine\Barrier; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -62,6 +63,12 @@ class FileChangeCustomProcess extends Command go(function () { $this->trigger_reload(); }); + go(function () { + $sign = Coroutine::waitSignal(SIGTERM, -1); + if ($sign) { + proc_open("php " . APP_PATH . "kiri.php sw:server stop", [], $pipes); + } + }); go(function () use ($driver) { $driver->start(); });