guard/rb-inotify

Ability to exclude certain files when using recursive watch

shrutika10 opened this issue · 4 comments

We need to be able to exclude certain files when using recursive watch. Currently i did not find anything. Does it already exist? How do we use it?

I personally use find and individually watch files that I do want.

nex3 commented

Unless you're individually calling it file-by-file, inotify watches directories, not files. You'll just need to filter out the events after the fact.

Just ran into this problem when using docker. I had a volume for postgresql data owned by root in my project, and rb-inotify just crashed. I'm moving it elsewhere as a workaround, but it would be nice to ignore it and not crash. Maybe that is a Linux problem and there is nothing that the library can do.

Having the same issue right now. So is it somehow possible to ignore certain directories?

It looks like overriding RECURSIVE_BLACKLIST should help. But changing / redefining constants is definitely not a good style. Also it is difficult to configure that if rb-inotify is initialized by another library.

Also the check for the recursive blacklist have to be before the call to Dir.new(path) because permission error would appear otherwise anyway.

Maybe making it configurable with an ENV variable would be a simpler solution?

It would help gems like listen or guard if this could be fixed (1, 2, 3, 4, 5).