From abc54080ec8c43e8989c081d934b59f0c9570c0b Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Wed, 15 Aug 2018 20:51:27 -0600 Subject: Add configFile(s) back to the watch list after REMOVE event Fixes #4701 --- commands/hugo.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commands/hugo.go b/commands/hugo.go index fc8dced74..a97c28294 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -705,6 +705,18 @@ func (c *commandeer) newWatcher(dirList ...string) (*watcher.Batcher, error) { if ev.Op&fsnotify.Chmod == fsnotify.Chmod { continue } + if ev.Op&fsnotify.Remove == fsnotify.Remove { + for _, configFile := range c.configFiles { + counter := 0 + for watcher.Add(configFile) != nil { + counter++ + if counter >= 100 { + break + } + time.Sleep(100 * time.Millisecond) + } + } + } // Config file changed. Need full rebuild. c.fullRebuild() break -- cgit v1.2.3