cf. FSEvents on OSX, which by default collects FS events over 1 second (timeout configurable) before firing off the event.
This has the benefit of collecting a series of filesystem changes into a single event (so the script won't run more than it needs to), at the cost of latency.
For instance, saving a file in Vim modifies many temp files (it tends to delete a buffer file, update an undo file, and also creates and then erases a test file called 4193
) in addition to the file itself. On OSX with a small tool that uses this API such as my fork of fswatch, all of these can get collapsed into one "batch event", whereas with inotifywait -m
all the events that I specify come over the stream in separate lines making it not simple to group without external processing.
I'm pretty sure the solution is to just to wrap it and do this processing but I was hoping there was a hidden feature to specify a timeout like the FSEvents allows for.