aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands
diff options
context:
space:
mode:
authorPedro Melo <[email protected]>2016-07-26 21:18:15 +0100
committerBjørn Erik Pedersen <[email protected]>2016-07-26 22:18:15 +0200
commit3e1b579c17e3597b5a1bafd1d86f6b0b1d06ca52 (patch)
tree0dce1a5a2556ac66c8b370b97b9a286b36183d29 /commands
parent91b61b976d8d32ef041506bcbc5f3ed3bf888986 (diff)
downloadhugo-3e1b579c17e3597b5a1bafd1d86f6b0b1d06ca52.tar.gz
hugo-3e1b579c17e3597b5a1bafd1d86f6b0b1d06ca52.zip
Be less aggressive with CHMOD filesystem events
On 4679fbee41d3, rebuild was disabled on CHMOD filesystem events, but the code is overly aggressive. In some situations, specially with older Mac's (using a Late 2008 Macbook), the events we receive might be aggregated. On my particular laptop, I get this events: INFO: 2016/07/26 18:08:51 hugo.go:737: Received System Events: ["<path>": WRITE|CHMOD] These events are ignored because the code only checks for Chmod. This commit fixes this by checking that the event is also not a Write or Create. Related to #1587.
Diffstat (limited to 'commands')
-rw-r--r--commands/hugo.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index d1b82d804..f05b3da65 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -775,7 +775,10 @@ func NewWatcher(port int) error {
// A workaround is to put your site(s) on the Spotlight exception list,
// but that may be a little mysterious for most end users.
// So, for now, we skip reload on CHMOD.
- if ev.Op&fsnotify.Chmod == fsnotify.Chmod {
+ // We do have to check for WRITE though. On slower laptops a Chmod
+ // could be aggregated with other important events, and we still want
+ // to rebuild on those
+ if ev.Op&(fsnotify.Chmod|fsnotify.Write|fsnotify.Create) == fsnotify.Chmod {
continue
}