From 89e72ceea113984bd6022e3bd9152c983ee8cd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 19 Apr 2023 13:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HotReload.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HotReload.php b/HotReload.php index 79d4184..8c7cf13 100644 --- a/HotReload.php +++ b/HotReload.php @@ -49,10 +49,13 @@ class HotReload extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - pcntl_signal(SIGINT | SIGQUIT | SIGTERM, function () { - $this->stopProcess(); - }); $this->startProcess(); + $signal = SIGINT | SIGQUIT | SIGTERM; + $bool = Process::signal($signal, function () { + $this->stopProcess(); + Process::wait(); + }); + echo 'Listen signal ' . ($bool ? 'success' : 'fail') . PHP_EOL; if (extension_loaded('inotify')) { $this->onInotifyReload(); } else {