Skip to content

Commit

Permalink
Merge pull request #112 from xuzixx/master
Browse files Browse the repository at this point in the history
Issue 111: TestReSeekInotify failed
  • Loading branch information
Nino-K authored Jul 7, 2017
2 parents 2b56f87 + 89ee1af commit cd5bbb3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions watch/inotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
}

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:
fallthrough

Expand All @@ -113,6 +104,10 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChange
changes.NotifyDeleted()
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:
fi, err := os.Stat(fw.Filename)
if err != nil {
Expand Down

0 comments on commit cd5bbb3

Please sign in to comment.