Implement unwatching a path

This commit is contained in:
T. R. Bernstein
2026-03-11 18:40:08 +01:00
parent 564c409c15
commit 5247d898cd
3 changed files with 25 additions and 0 deletions

View File

@@ -21,6 +21,13 @@ public actor Inotify {
return wd
}
public func removeWatch(_ wd: Int32) throws {
guard inotify_rm_watch(self.fd, wd) == 0 else {
throw InotifyError.removeWatchFailed(watchDescriptor: wd, errno: cinotify_get_errno())
}
watches.removeValue(forKey: wd)
}
deinit {
cinotify_deinit(self.fd)
}