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

watch-mode auto not working in Vagrant vm #156

Open
Sgoettschkes opened this issue Nov 6, 2017 · 2 comments
Open

watch-mode auto not working in Vagrant vm #156

Sgoettschkes opened this issue Nov 6, 2017 · 2 comments

Comments

@Sgoettschkes
Copy link

I'm using Vagrant (a wrapper for virtual machines) for my projects which means each project lives inside a virtual machine. The source code is on my host machine and a mount is created inside the vm to have the code available there too.

Running lein doo node test once inside the vm works as expected and running lein doo node test works as well (the correct tests are executed and the watcher is started), but file changes are never picked up.

Watching for file changes is always a problem with mounted folders. For figwheel, I have to use the :hawk-options {:watcher :polling} setting, otherwise it doesn't pick up any changes either. lein-test-refresh works out of the box.

@miikka
Copy link
Collaborator

miikka commented Nov 14, 2017

Doo uses ClojureScript's built-in watching functionality, which is implemented using java.nio.file.WatchService (the same as Figwheel's watch default settings). WatchService looks at the file system events, but they do not get forwarded from the host to the Vagrant guest, which causes the problems. To fix this, I see a couple of possible approaches:

  1. convince ClojureScript to add support for alternative ways of watching,
  2. re-implement watching in Doo (maybe using hawk to make it configurable the same way as Figwheel),
  3. somehow piggyback on Figwheel's watcher or on cljsbuild's auto mode?

(For the record: lein-test-refresh uses clojure.tools.namespace's change tracking.)


As a workaround, you might want to check out some of the Vagrant plugins for forwarding file system events: vagrant-notify-forwarder, vagrant-fsnotify. Haven't tried any of them myself, though.

@Sgoettschkes
Copy link
Author

Thanks for the detailed analysis, miikka. I am using a Vagrant plugin right now and it works well. As you pointed out, this is only a workaround because most of the notifier plugins to not work on all platforms, are error-prone and it's an additional setup step which might get lost.

I appreciate your list of possible approaches and would consider working towards the one you think would be most feasible.

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

2 participants