Skip to content

Fix WSL auto-rebuild by switching Watcher depending on the fs - #434

Open
Mityno wants to merge 5 commits into
encounter:mainfrom
Mityno:fix/wsl-rebuild
Open

Mityno wants to merge 5 commits into
encounter:mainfrom
Mityno:fix/wsl-rebuild

Conversation

@Mityno

@Mityno Mityno commented Nov 21, 2026

Copy link
Copy Markdown

Hello,

Issue #121 poses the problem of rebuild on changes for WSL when using notify::RecommendedWatcher.
This PR aims to solve it by auto switching the watcher to notify::PollWatcher (as recommended in notify's documentation) when the watched path is detected to be a network FS. The check for network FS is only done for Windows builds in the implementation (mainly to only aim WSL).

The old Watcher type has been redefined to an enum AnyDebouncer type which has two debouncers NativeDebouncer and NetworkFSDebouncer, that use either notify::RecommendedWatcher or notify::PollWatcher (and call their own watch method).

I also reduced error logging verbosity for watch errors on ignored paths (which happens a lot with symlinks that go out of the watched dir). If this is not wanted I will revert it.

This is my first PR on a Rust project, please feel free give feedback on things that I should change.
Thanks for reading, have a nice day!

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.

1 participant