shithub: hugo

Download patch

ref: abc54080ec8c43e8989c081d934b59f0c9570c0b
parent: a655e00d702dbc20b3961b131b33ab21841b043d
author: Anthony Fok <[email protected]>
date: Wed Aug 15 16:51:27 EDT 2018

Add configFile(s) back to the watch list after REMOVE event

Fixes #4701

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -705,6 +705,18 @@
 						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