From 6a1dc5eced4cc17c7165537602b7bc95887a5b40 Mon Sep 17 00:00:00 2001 From: Facundo Olano Date: Mon, 10 Jun 2024 16:36:27 -0300 Subject: [PATCH] don't skip reload on chmod if it's also write event (#38) --- commands/serve.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/serve.go b/commands/serve.go index c39ed73..33f4f3f 100644 --- a/commands/serve.go +++ b/commands/serve.go @@ -99,10 +99,11 @@ func runWatcher(config *config.Config, broker *EventBroker) (*fsnotify.Watcher, go func() { for event := range watcher.Events { - // chmod events are noisy, ignore them. + // chmod events are noisy, ignore them. But not if they are also a write event. + isChmod := event.Has(fsnotify.Chmod) && !event.Has(fsnotify.Write) // Also ignore dot file events, which are usually spurious (e.g .DS_Store, emacs temp files) isDotFile := strings.HasPrefix(filepath.Base(event.Name), ".") - if event.Has(fsnotify.Chmod) || isDotFile { + if isChmod || isDotFile { continue }