diff options
Diffstat (limited to 'vendor/github.com/rjeczalik/notify/watcher_kqueue.go')
-rw-r--r-- | vendor/github.com/rjeczalik/notify/watcher_kqueue.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/github.com/rjeczalik/notify/watcher_kqueue.go b/vendor/github.com/rjeczalik/notify/watcher_kqueue.go index d5f7788c4..6d500b700 100644 --- a/vendor/github.com/rjeczalik/notify/watcher_kqueue.go +++ b/vendor/github.com/rjeczalik/notify/watcher_kqueue.go @@ -157,14 +157,15 @@ func (k *kq) IsStop(n interface{}, err error) bool { } func init() { - encode = func(e Event) (o int64) { + encode = func(e Event, dir bool) (o int64) { // Create event is not supported by kqueue. Instead NoteWrite event will - // be registered. If this event will be reported on dir which is to be - // monitored for Create, dir will be rescanned and Create events will - // be generated and returned for new files. In case of files, - // if not requested NoteRename event is reported, it will be ignored. + // be registered for a directory. If this event will be reported on dir + // which is to be monitored for Create, dir will be rescanned + // and Create events will be generated and returned for new files. + // In case of files, if not requested NoteRename event is reported, + // it will be ignored. o = int64(e &^ Create) - if e&Write != 0 { + if (e&Create != 0 && dir) || e&Write != 0 { o = (o &^ int64(Write)) | int64(NoteWrite) } if e&Rename != 0 { |