Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File watcher doesn't work on mounted files on Docker (Windows host) #313

Open
casab opened this issue Jan 21, 2025 · 3 comments
Open

File watcher doesn't work on mounted files on Docker (Windows host) #313

casab opened this issue Jan 21, 2025 · 3 comments

Comments

@casab
Copy link

casab commented Jan 21, 2025

I am running bacon --headless run-long on a docker dev container to hot reload. Container is using volume mounted from Windows host and bacon should be watching the files on that volume. Running on windows and running on linux works fine. But for some reason file watcher doesn't seem to work on this specific case.

I think bacon checks for the file changes by listening inotify events. Is there any option that uses polling instead that I have missed?

@Canop Canop changed the title File watcher doesn't work on mounted files on Docker File watcher doesn't work on mounted files on Docker (Windows host) Jan 21, 2025
@Canop
Copy link
Owner

Canop commented Jan 21, 2025

Is there any option that uses polling instead that I have missed?

No, there's none today.

@casab
Copy link
Author

casab commented Jan 21, 2025

I checked out how notify-rs defines watchers. And how bacon uses notify. RecommendedWatcher fallsback to PollWatcher when the target is not available. Also it's advised to use PollWatcher in such cases; https://docs.rs/notify/latest/notify/#network-filesystems

I found similar issues around. Especially this;

notify-rs/notify#254

So, I tried modifying Watcher in src/watcher.rs. I have replaced RecommendedWatcher with PollWatcher, with this config;

Config::default()
                .with_poll_interval(Duration::from_secs(5))
                .with_compare_contents(true)

Still didn't work. I thought if I could be sure that PollWatcher works for every system. I could just add a new option like --poll <seconds`> or add some logic that checks for wsl. But, oh well...

@tmanuszak
Copy link

I was also encountering this exact same problem with a mac host today.

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

No branches or pull requests

3 participants