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:
- The path matched against the user's glob/regex is documented as having a trailing
/
if and only if the path is a directory. - 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.