From 7b300d4ffe2564d921cc3c4a675ecd0ae29855c7 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 8 Jun 2022 17:13:41 +0200 Subject: [PATCH] backend: Check file error --- backend/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/main.go b/backend/main.go index 058a9642..50cb87cd 100644 --- a/backend/main.go +++ b/backend/main.go @@ -181,15 +181,15 @@ func main() { if err := watchsubdir(watcher, ev.Name); err != nil { log.Println(err) } - } else if ev.Op&watchedNotify == watchedNotify && d.Mode().IsRegular() { + } else if err == nil && ev.Op&watchedNotify == watchedNotify && d.Mode().IsRegular() { if *debugINotify { log.Println("Treating event:", ev, "for", ev.Name) } go treat(ev.Name) - } else if ev.Op&fsnotify.Write == fsnotify.Write { + } else if err == nil && ev.Op&fsnotify.Write == fsnotify.Write { log.Println("FSNOTIFY WRITE SEEN. Prefer looking at them, as it appears files are not atomically moved.") watchedNotify = fsnotify.Write - } else if *debugINotify { + } else if err == nil && *debugINotify { log.Println("Skipped event:", ev, "for", ev.Name) } case err := <-watcher.Errors: