From 263b4d53ebb2bf7af9bc0db1f9995a99aaad7cd4 Mon Sep 17 00:00:00 2001 From: xl Date: Mon, 18 Nov 2024 14:19:31 +0800 Subject: [PATCH] eee --- Abstracts/HotReload.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Abstracts/HotReload.php b/Abstracts/HotReload.php index 6a3f90f..cf41f63 100644 --- a/Abstracts/HotReload.php +++ b/Abstracts/HotReload.php @@ -81,17 +81,17 @@ class HotReload extends AbstractProcess public function process(Process|null $process): void { $this->addListen(); + + Event::add($this->pipe, function () use ($process) { + $read = inotify_read($this->pipe); + if (!empty($read)) { + $this->reload(); + } + }); Event::cycle(function (): void { if ($this->isStop()) { - $read = inotify_read($this->pipe); - if (!empty($read)) { - $this->reload(); - } - } else { Event::exit(); } - - Event::dispatch(); }); Event::wait(); }