From 65d3475b5cb329453d177d2ea0c4ff03eba1f618 Mon Sep 17 00:00:00 2001 From: wanyuteng Date: Tue, 18 Jul 2017 20:59:11 +0800 Subject: [PATCH] does not detect file that has been deleted and recreated when use Inotify --- vendor/gopkg.in/fsnotify.v1/inotify.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vendor/gopkg.in/fsnotify.v1/inotify.go b/vendor/gopkg.in/fsnotify.v1/inotify.go index d7759ec8..70a62992 100644 --- a/vendor/gopkg.in/fsnotify.v1/inotify.go +++ b/vendor/gopkg.in/fsnotify.v1/inotify.go @@ -300,7 +300,13 @@ func newEvent(name string, mask uint32) Event { e.Op |= Rename } if mask&syscall.IN_ATTRIB == syscall.IN_ATTRIB { - e.Op |= Chmod + _, statErr := os.Lstat(e.Name) + if os.IsNotExist(statErr) { + fmt.Printf("in attrib Remove %#v\n\n", mask&syscall.IN_CREATE) + e.Op |= Remove + } else { + e.Op |= Chmod + } } return e }