Skip to content

Commit 70c2485

Browse files
committed
fix: ignoring events from excluded-dirs sub path
1 parent 76d04c5 commit 70c2485

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/watcher/watcher.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ func (f fsnWatcher) ignoreEvent(event fsnotify.Event) (ignore bool, reason strin
6868
return true, "event is from a special file from vim/neovim which ends in ~"
6969
}
7070

71+
for k := range f.ExcludeDirs {
72+
if strings.HasPrefix(event.Name, k) {
73+
return true, "event is generating from an excluded path"
74+
}
75+
}
76+
7177
for _, suffix := range f.IgnoreSuffixes {
7278
if strings.HasSuffix(event.Name, suffix) {
7379
f.Logger.Debug("file is ignored", "file", event.Name)
@@ -152,7 +158,9 @@ func (f *fsnWatcher) RecursiveAdd(dirs ...string) error {
152158

153159
fi, err := os.Lstat(dir)
154160
if err != nil {
155-
return err
161+
continue
162+
// INFO: instead of returning and error, seems like ignore is a better choice
163+
// return err
156164
}
157165

158166
if !fi.IsDir() {

0 commit comments

Comments
 (0)