-
Notifications
You must be signed in to change notification settings - Fork 249
Description
OS: Linux (Ubuntu 14.10)
Listen version: 3.03
Minimal test case:
mkdir dir
ln -s dir dir2
ruby -e "require 'listen'; Listen.to('.').start"
** ERROR: directory is already being watched! **
Directory: [path]/dir
is already begin watched through: [path]/dir
MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
My use case is that I would like to use spring-watcher-listen + Listen 3.0 in a Rails project containing several local symlinks which cannot be removed. Since #273, running Listen spams standard error with the above verbose text for what is a benign and extremely common scenario.
For my case, my workaround for now is to silence the SymlinkDetector with this monkey-patch:
require 'listen/record/symlink_detector'
module Listen
class Record
class SymlinkDetector
def _fail(_, _)
fail Error, "Don't watch locally-symlinked file twice"
end
end
end
end
I agree with the discussion in #273 that distinguishing between (harmless) local symlinks and (problematic) filesystem loops would be the 'Best solution' for this issue, as I believe that the current implementation throws out the baby with the bathwater, so to speak. As long as the 'Best' implementation remains a 'pointless waste of time', would it at least be possible to add an opt-in mechanism for suppressing this verbose ERROR
message so that the local symlink warning could be suppressed without requiring this patch?