Restores error propagation from fsnotify.Watcher.Add.

This commit is contained in:
Vlad Losev 2017-03-20 18:08:26 -07:00
parent 669c44045e
commit 2e79377851
No known key found for this signature in database
GPG Key ID: 3A3C3B9FAA3AB7AE
2 changed files with 4 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
//With an open fd, unlink(fd) - inotify returns IN_ATTRIB (==fsnotify.Chmod) //With an open fd, unlink(fd) - inotify returns IN_ATTRIB (==fsnotify.Chmod)
case evt.Op&fsnotify.Chmod == fsnotify.Chmod: case evt.Op&fsnotify.Chmod == fsnotify.Chmod:
if _, err := os.Stat(fw.Filename); err != nil { if _, err := os.Stat(fw.Filename); err != nil {
if ! os.IsNotExist(err) { if !os.IsNotExist(err) {
return return
} }
} }

View File

@ -153,7 +153,9 @@ func (shared *InotifyTracker) addWatch(winfo *watchInfo) error {
if shared.watchNums[fname] == 0 { if shared.watchNums[fname] == 0 {
err = shared.watcher.Add(fname) err = shared.watcher.Add(fname)
} }
if err == nil {
shared.watchNums[fname]++ shared.watchNums[fname]++
}
return err return err
} }