diff --git a/Inotify.php b/Inotify.php index a2bb444..0849dc4 100644 --- a/Inotify.php +++ b/Inotify.php @@ -96,17 +96,15 @@ class Inotify extends BaseProcess $this->watch($dir); } Event::add($this->inotify, [$this, 'check']); + Event::cycle(function () { + Event::del($this->inotify); + }); Event::wait(); } public function clear() { - if (is_null($this->inotify)) { - return; - } - Event::del($this->inotify); - Event::exit(); }