From 52845dfdb81075e79306dcd524b8a987d656cce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 4 Nov 2021 18:56:54 +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 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/kiri-engine/FileListen/FileChangeCustomProcess.php b/kiri-engine/FileListen/FileChangeCustomProcess.php index f17e19ec..469701cb 100644 --- a/kiri-engine/FileListen/FileChangeCustomProcess.php +++ b/kiri-engine/FileListen/FileChangeCustomProcess.php @@ -73,7 +73,7 @@ class FileChangeCustomProcess extends Command } }); go(function () use ($driver) { - $this->source = proc_open('php ' . APP_PATH . 'kiri.php', [], $this->pipes); + proc_open('php ' . APP_PATH . 'kiri.php', [], $pipes); $driver->start(Coroutine::getCid()); }); @@ -107,16 +107,12 @@ class FileChangeCustomProcess extends Command Kiri::getDi()->get(Logger::class)->warning('change reload'); $content = file_get_contents(storage('.swoole.pid')); - if (!empty($content)) { - Process::kill((int)$content, 15); - - var_dump($content, $this->pipes); - - proc_close($this->source); + if (Process::kill((int) $content, 0)) { + Process::kill((int) $content, SIGTERM); + } } - - $this->source = proc_open("php " . APP_PATH . "kiri.php", [], $this->pipes); + proc_open("php " . APP_PATH . "kiri.php", [], $pipes); } }