From 8ba04b4ccc813c3eb157df76f1ab20fb8f02c491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 4 Nov 2021 18:15:56 +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 --- .../FileListen/FileChangeCustomProcess.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kiri-engine/FileListen/FileChangeCustomProcess.php b/kiri-engine/FileListen/FileChangeCustomProcess.php index 86ee3922..5b1637b7 100644 --- a/kiri-engine/FileListen/FileChangeCustomProcess.php +++ b/kiri-engine/FileListen/FileChangeCustomProcess.php @@ -71,7 +71,9 @@ class FileChangeCustomProcess extends Command $sign = Coroutine::waitSignal(SIGTERM, -1); if ($sign) { $this->closeProc(); - $this->source = proc_open("php " . APP_PATH . "kiri.php sw:server stop", [], $this->pipes); + $this->source = proc_open("php " . APP_PATH . "kiri.php sw:server stop", [ + STDIN, STDOUT + ], $this->pipes); $this->closeProc(); } }); @@ -107,8 +109,14 @@ class FileChangeCustomProcess extends Command { Kiri::getDi()->get(Logger::class)->warning('change reload'); - $this->closeProc(); - $this->source = proc_open("php " . APP_PATH . "kiri.php sw:server restart", [], $this->pipes); + if (is_resource($this->source)) { + fwrite($this->source, "php " . APP_PATH . "kiri.php sw:server restart"); + } else { + $this->source = proc_open("php " . APP_PATH . "kiri.php sw:server restart", [], $this->pipes); + + var_dump($this->pipes); + } + } @@ -117,10 +125,6 @@ class FileChangeCustomProcess extends Command foreach ($this->pipes as $pipe) { fclose($pipe); } - var_dump($this->pipes); - if (is_resource($this->source)) { - proc_close($this->source); - } } }