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

Deno.watchFs is not working in WSL environment #6966

Open
aaronwlee opened this issue Aug 6, 2020 · 9 comments
Open

Deno.watchFs is not working in WSL environment #6966

aaronwlee opened this issue Aug 6, 2020 · 9 comments
Labels
bug Something isn't working correctly cli related to cli/ dir upstream Changes in upstream are required to solve these issues windows Related to Windows platform

Comments

@aaronwlee
Copy link

Deno.watchFs is not working in WSL(Ubuntu 18.04 LTS Bionic) environment.
Literally, there are no event messages after changing any files.

@Spoonbender
Copy link
Contributor

@aaronwlee please specify which version of Windows you are using, as it didn't always have support for these events (see https://devblogs.microsoft.com/commandline/wsl-adds-inotify-filesystem-change-notification-support/ )

@aaronwlee
Copy link
Author

@Spoonbender I'm using Windows 10 19041.388 OS build and using wsl2.

what I'm claiming that it was working with the previous version.

@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir windows Related to Windows platform labels Aug 27, 2020
@Leokuma
Copy link

Leokuma commented Jan 26, 2021

Probably related: notify-rs/notify#254

I believe that problem affects deno run --watch too.

Running Deno inside Docker on Windows with WSL2 enabled, deno run --watch never detects any file changes even if I enter the container and change the file from inside the container (Alpine Linux in my case). If I change my Docker settings not to use WSL2, it works perfectly.

@lucacasonato lucacasonato added the upstream Changes in upstream are required to solve these issues label Jul 20, 2021
@BMogetta
Copy link

BMogetta commented Jun 2, 2022

same problem here 02/june/2022

@twome
Copy link

twome commented Jul 13, 2022

Same here:

  • Win 10 x64 build 19044.1766
  • WSL2; Ubuntu

Inside WSL2, touching a watched file reliably triggers watchFs, whereas inside Windows, saving a file stored on a Windows/NTFS drive that is mounted into WSL (e.g. as /mnt/g/somefile.js) never triggers watchFs.

@0xpr03
Copy link

0xpr03 commented Sep 4, 2022

saving a file stored on a Windows/NTFS drive that is mounted into WSL (e.g. as /mnt/g/somefile.js) never triggers watchFs

This won't work* as long as you don't want to add a workaround by either switching to a polling-based change detection, through some sort of flag, or detecting WSL2 and then using the workaround. Notify simply won't receive file-events for windows-owned files inside WSL2.

*or wait for WSL2 to maybe fix that problem

@twome
Copy link

twome commented Sep 10, 2022

@0xpr03 yeah I assumed as much. watchFs should be changed to detect WSL (might be good to do this earlier/higher up within Deno anyway, setting a user-visible flag) & then either (a) give an error message explaining this issue, or (b) fall back to polling. The silent failure's no bueno.

@0xpr03
Copy link

0xpr03 commented Sep 10, 2022

I'm thinking about adding some runtime-detection based fallback to notify. This could also contain a WSL detection. But truth be told: If you want "performance", don't use the pollwatcher, if you want full compatibility, use it. So either way it is a trade-off.

@Kyiro
Copy link

Kyiro commented Jan 18, 2023

You can use WSL 1 as a workaround for this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir upstream Changes in upstream are required to solve these issues windows Related to Windows platform
Projects
None yet
Development

No branches or pull requests

9 participants