diff options
author | Anthony Fok <[email protected]> | 2018-08-15 20:51:27 -0600 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-08-16 16:11:57 +0200 |
commit | abc54080ec8c43e8989c081d934b59f0c9570c0b (patch) | |
tree | 964d752200eaf2ae865f9e9e60ed140cd87aed15 /commands/hugo.go | |
parent | a655e00d702dbc20b3961b131b33ab21841b043d (diff) | |
download | hugo-abc54080ec8c43e8989c081d934b59f0c9570c0b.tar.gz hugo-abc54080ec8c43e8989c081d934b59f0c9570c0b.zip |
Add configFile(s) back to the watch list after REMOVE event
Fixes #4701
Diffstat (limited to 'commands/hugo.go')
-rw-r--r-- | commands/hugo.go | 12 |
1 files changed, 12 insertions, 0 deletions
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 |