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(); });