There was an error while loading. Please reload this page.
1 parent f7cf76f commit bbb8766Copy full SHA for bbb8766
src/MKraemer/ReactInotify/Inotify.php
@@ -93,7 +93,14 @@ public function remove($descriptor)
93
{
94
if (isset($this->watchDescriptors[$descriptor])) {
95
unset($this->watchDescriptors[$descriptor]);
96
- \inotify_rm_watch($this->inotifyHandler, $descriptor);
+
97
+ if ($this->watchDescriptors) {
98
+ // there are still watch paths remaining => only remove this descriptor
99
+ \inotify_rm_watch($this->inotifyHandler, $descriptor);
100
+ } else {
101
+ // no more paths watched => close whole handler
102
+ $this->close();
103
+ }
104
}
105
106
0 commit comments