Open cemerick opened 11 years ago
FWIW, I've tried using the JDK7 watch service before and it seems like an actual nightmare to use. I got to a page and a half of code before I gave up.
If you do come up with a Clojure way to use it, you should absolutely wrap it and release as a separate lib. Or even better, come up with a decent Java wrapper.
This is what I have used before: https://gist.github.com/hugoduncan/6393438
There is also: https://github.com/rplevy/ojo (I've not used it)
@hugoduncan thanks for the tips! I absolutely love it when I wish for stuff and it turns out that someone else has already made 'em = )
There's another implementation of this at https://github.com/juxt/dirwatch
On a separate note, switching to a WatchService
without any polling would break my use case: compiling .cljs files on a cifs mount. Linux doesn't get inotify events when they're edited on the remote machine. I could work around it with a hack like https://github.com/rubyruy/watchntouch, though. (via this question)
Given the perf I'm seeing of the current manual mtime "watch" approach (only post-gh-219), I'm currently unconvinced of the need for inotify-style watching. References to cljs projects that exhibit poor CPU utilization while running
lein cljsbuild auto
are welcome as counterpoints.