-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
between retrieving file names and stat during filepath.Walk
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,9 +495,11 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo { | |
list, err = w.listRecursive(name) | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
w.Error <- ErrWatchedFileDeleted | ||
w.mu.Unlock() | ||
w.RemoveRecursive(err.(*os.PathError).Path) | ||
if name == err.(*os.PathError).Path { | ||
w.Error <- ErrWatchedFileDeleted | ||
w.RemoveRecursive(name) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tomek-cz
|
||
} | ||
w.mu.Lock() | ||
} else { | ||
w.Error <- err | ||
|
@@ -507,9 +509,11 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo { | |
list, err = w.list(name) | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
w.Error <- ErrWatchedFileDeleted | ||
w.mu.Unlock() | ||
w.Remove(err.(*os.PathError).Path) | ||
if name == err.(*os.PathError).Path { | ||
w.Error <- ErrWatchedFileDeleted | ||
w.Remove(name) | ||
} | ||
w.mu.Lock() | ||
} else { | ||
w.Error <- err | ||
|
Hi @radovskyb, it look like you're removing the whole watched directory here form the list? I am hitting an issue where in case of ErrWatchedFileDeleted the watcher stops reporting new events for the directory I am watching.