emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
4.96k stars 327 forks source link

Improve responsiveness on macos: add support for kFSEventStreamCreateFlagNoDefer #230

Closed iwelch closed 2 years ago

iwelch commented 5 years ago

hi enrico---in the docs, you probably want to change "OS X" to "macos" now.

even with a latency request of 0.2, fswatch sometimes takes several seconds. Other apps, liked Marked 2 (https://marked2app.com/) are always instant, using fsevents.

regards, /iaw

emcrisostomo commented 4 years ago

Thank you very much @iwelch: in fact fswatch doesn't allow you to specify the kFSEventStreamCreateFlagNoDefer flag (libfswatch does):

Here is the documentation and the rationale for the behaviour of fswatch is:

This is the default behavior and is more appropriate for background, daemon or batch processing apps.

I'm marking this as an enhancement.

iwelch commented 4 years ago

Suggestion: If fswatch is running on a tty, make fast check the update. if fswatch is invoked in batch, make slow check the update. (and maybe allow a flag to toggle.)

emcrisostomo commented 4 years ago

Thanks, that's a good suggestion indeed.

emcrisostomo commented 2 years ago

This has been implemented in master. Thanks @iwelch