guard / listen

The Listen gem listens to file modifications and notifies you about the changes.

Home Page:https://rubygems.org/gems/listen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable recursion under Linux

sebbASF opened this issue · comments

commented

Does not seem possible to disable recursion under Linux.
It should be possible to watch a single directory, without any subdirectories.

@sebbASF I don't think this is a feature of the underlying drivers like fs-event, is it?

It's not too hard to skip over the changes you don't want in the callbacks, is it?

commented

It may not be hard, but why not allow this to be optionally done by the library?

but why not allow this to be optionally done by the library?

I was thinking to keep this gem uncomplicated. But if you want to propose an interface that allows that, please throw a proposal together.

Also, just to confirm, it sounds like you agree that this isn't a feature of the underlying drivers like fs-event?

commented

AIUI under Linux, the gem uses inotify via rb-inotify.
Now inotify does not support recursion directly, so rb-inotify emulates this if the :recursive flag is provided.
By default it looks like listen includes the :recursive flag when configuring rb-inotify.

The problem is that it does not appear to be possible to disable this setting.

commented

This is important because each additional directory monitored by inotify takes up system resources.
So although events can be filtered out later, for large directory trees there can be significant overhead.

Now inotify does not support recursion directly, so rb-inotify emulates this if the :recursive flag is provided.
By default it looks like listen includes the :recursive flag when configuring rb-inotify.

Ok, that sounds like a good reason to allow recursion to be disabled. If we support that, we'll need to disable it on the other drivers too. How difficult does that seem?