Merge pull request #112 from xuzixx/master

Issue 111: TestReSeekInotify failed
This commit is contained in:
Nino Kodabande 2017-07-07 12:19:11 -07:00 committed by GitHub
commit cd5bbb3d4d
1 changed files with 4 additions and 9 deletions

View File

@ -96,15 +96,6 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
} }
switch { switch {
//With an open fd, unlink(fd) - inotify returns IN_ATTRIB (==fsnotify.Chmod)
case evt.Op&fsnotify.Chmod == fsnotify.Chmod:
if _, err := os.Stat(fw.Filename); err != nil {
if ! os.IsNotExist(err) {
return
}
}
fallthrough
case evt.Op&fsnotify.Remove == fsnotify.Remove: case evt.Op&fsnotify.Remove == fsnotify.Remove:
fallthrough fallthrough
@ -113,6 +104,10 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
changes.NotifyDeleted() changes.NotifyDeleted()
return return
//With an open fd, unlink(fd) - inotify returns IN_ATTRIB (==fsnotify.Chmod)
case evt.Op&fsnotify.Chmod == fsnotify.Chmod:
fallthrough
case evt.Op&fsnotify.Write == fsnotify.Write: case evt.Op&fsnotify.Write == fsnotify.Write:
fi, err := os.Stat(fw.Filename) fi, err := os.Stat(fw.Filename)
if err != nil { if err != nil {