}
// Follow Symlinks
+ // Unfortunately, Linux can add bogus symlinks to watch list without
+ // issue, and Windows can't do symlinks period (AFAIK). To maintain
+ // consistency, we will act like everything is fine. There will simply
+ // be no file events for broken symlinks.
+ // Hence the returns of nil on errors.
for fi.Mode()&os.ModeSymlink == os.ModeSymlink {
path, errstat = os.Readlink(path)
if errstat != nil {
- return errstat
+ return nil
}
fi, errstat = os.Lstat(path)
if errstat != nil {
- return errstat
+ return nil
}
}
t.Fatalf("Watcher.Watch() failed: %s", err)
}
- // We expect this event to be received immediately, as they happen during Watch() call
- if errorsReceived == 0 {
- t.Fatal("fsnotify errors have not been received.")
+ // Should not be error, just no events for broken links (watching nothing)
+ if errorsReceived > 0 {
+ t.Fatal("fsnotify errors have been received.")
}
// Try closing the fsnotify instance