I'm looking for a cross-platform (Linux and OS X) file system watcher that doesn't poll the disk for changes (or is very efficient in doing so).
This will be the core piece of a continuous integration server, and handle things such as compiling LESS/SCSS, running javascript tests, and running custom scripts. I'd like to specify a list of files and directories, and commands to execute when a file or folder changes.
I'd like something node.js, python, shell script, or ruby based.
Some of the tools I've looked at so far...
https://github.com/tafa/node-watch-tree
https://github.com/mikeal/watch/blob/master/main.js
doc.qt.nokia.com/latest/qfilesystemwatcher.html
buildr.apache.org/building.html#continuous-compilation
www.javascriptkata.com/2010/10/28/ready-js-prepare-your-javascript-for-production/
Any recommendations appreciated.
Other than being written in C, entr looks like what you want.
Cross-platform? It's very hard. I do not know any effective cross-platform implementation but, perhaps, I can suggest a starting point.
Linux has iNotify API, a kernel feature that monitors file systems and immediately alerts an attentive application to relevant events. The BSD/Mac-OS equivalent is kqueue. The two APIs seem very similar each other.
I found on CPAN, some perl wrapper for each one of them. I have no experience in python but I googled some wrapper of these APIs also in phyton. You have "only" to write your own wrapper around them to obtain your cross-platform library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With