From 389c376c436399a53e8c3098f1bc665c1373f9c3 Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 5 Nov 2021 00:32:52 +0800 Subject: [PATCH] 111 --- kiri-engine/FileListen/FileChangeCustomProcess.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kiri-engine/FileListen/FileChangeCustomProcess.php b/kiri-engine/FileListen/FileChangeCustomProcess.php index 7f077368..633b9191 100644 --- a/kiri-engine/FileListen/FileChangeCustomProcess.php +++ b/kiri-engine/FileListen/FileChangeCustomProcess.php @@ -34,7 +34,7 @@ class FileChangeCustomProcess extends Command protected mixed $source = null; protected mixed $pipes = []; - protected Coroutine\Channel $channel; + protected ?Coroutine\Channel $channel = null; /** @@ -44,9 +44,6 @@ class FileChangeCustomProcess extends Command { $this->setName('sw:wather') ->setDescription('server start'); - - $this->channel = new Coroutine\Channel(1); - $this->channel->push(true); } @@ -103,6 +100,11 @@ class FileChangeCustomProcess extends Command Process::kill($content, SIGTERM); } Coroutine::create(function () { + if (!$this->channel) { + $this->channel = new Coroutine\Channel(1); + $this->channel->push(true); + } + $this->channel->pop(); proc_open("php " . APP_PATH . "kiri.php", [], $pipes);