diff --git a/watch/inotify.go b/watch/inotify.go index b4e6544..7cab0fd 100644 --- a/watch/inotify.go +++ b/watch/inotify.go @@ -107,6 +107,7 @@ func (fw *InotifyFileWatcher) ChangeEvents(t tomb.Tomb, fi os.FileInfo) *FileCha }else{ changes.NotifyModified() } + prevSize = fw.Size } } }() diff --git a/watch/polling.go b/watch/polling.go index 773c82a..a5d8fb0 100644 --- a/watch/polling.go +++ b/watch/polling.go @@ -80,8 +80,10 @@ func (fw *PollingFileWatcher) ChangeEvents(t tomb.Tomb, origFi os.FileInfo) *Fil fw.Size = fi.Size() if prevSize > 0 && prevSize > fw.Size { changes.NotifyTruncated() + prevSize = fw.Size continue } + prevSize = fw.Size // File was appended to (changed)? modTime := fi.ModTime()