Skip to content

fix(windows): return WatchNotFound when unwatching an unwatched path - #1014

Merged
JohnTitor merged 1 commit into
notify-rs:mainfrom
y-yagi:windows-unwatch-watch-not-found
Oct 3, 2026
Merged

JohnTitor merged 1 commit into
notify-rs:mainfrom
y-yagi:windows-unwatch-watch-not-found

Conversation

@y-yagi

@y-yagi y-yagi commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Description

ReadDirectoryChangesWatcher::unwatch always acked with Ok because remove_watch silently ignored paths that were not being watched. All other backends (inotify, FSEvents, kqueue, poll) return Error::watch_not_found() in that case.

Make remove_watch report whether a watch was removed, and ack Action::UnwatchAck with WatchNotFound (with the path attached, as inotify does) when nothing was removed. The internal Action::Unwatch used by the completion callback stays silent.

Related Issues

None

`ReadDirectoryChangesWatcher::unwatch` always acked with `Ok` because
`remove_watch` silently ignored paths that were not being watched. All
other backends (inotify, FSEvents, kqueue, poll) return
`Error::watch_not_found()` in that case.

Make `remove_watch` report whether a watch was removed, and ack
`Action::UnwatchAck` with `WatchNotFound` (with the path attached, as
inotify does) when nothing was removed. The internal `Action::Unwatch`
used by the completion callback stays silent.
@y-yagi
y-yagi force-pushed the windows-unwatch-watch-not-found branch from 789408b to 853364e Compare September 30, 2026 08:46
@y-yagi
y-yagi marked this pull request as ready for review September 30, 2026 08:55

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@JohnTitor
JohnTitor merged commit 2eff6d7 into notify-rs:main Oct 3, 2026
21 checks passed
@y-yagi
y-yagi deleted the windows-unwatch-watch-not-found branch October 4, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants