cespare / reflex

Run a command when files change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Report remove events

cespare opened this issue · comments

This was reported by @maysunfaisal on #58.

We should notify on remove events. For example, if you delete a .c file, you probably want to rerun make to see if the build broke.

It's tricky because we also need to know whether an event was for a directory or not. This is exposed to the user in two ways:

  1. The path matched against the user's glob/regex is documented as having a trailing / if and only if the path is a directory.
  2. The --only-dirs and --only-files flags allow the user to only match against one or the other.

Right now we don't know this information when we get a remove event because the file/directory is already gone. To implement this, we'd need to keep our own in-memory representation of the watched tree (or at least a set of known directories); we can reference this when we get a remove event.

I anticipate annoying corner cases where this cache gets out of sync with the filesystem.

This is related to #13 and possibly #39.