Hugo server --watch not... er... 'watching"


#1

Strange one this.

After working flawlessly for all the time I’ve been using Hugo, the --watch flag suddenly seems to have become unreliable.

I was working on a post today and noticed that hugo server --watch was not detecting edits I was making to the page. It would work for maybe the first edit [or perhaps two] and then would stop picking up further edits. If I used CTRL+C to quit the Hugo server and then started it again, the same pattern would repeat: it would pick up the first edit or two and then stop noticing them again.

Anybody else seen anything like this before?

The only thing I can think that I did differently from usual this time was to start by duplicating an existing post .md file using the Finder in OSX, rather than using hugo new blahblah.md. But surely that shouldn’t have made any difference. Doesn’t the --watch flag just monitor the entire site directory for changes? Otherwise how would it pick up edits to existing posts, as well as the current one?

VERSION: ``Hugo Static Site Generator v0.14 BuildDate: 2015-06-16T21:43:06+01:00```


#2

I have the same issue with TextMate in OSX (there is an open Hugo issue about it). Try to do the same edits in TextEdit (or whatever), and see if that works.


#3

Interesting.

I am using TextMate –but always have been, even when it was working flawlessly. I do seem to recall TextMate updating itself not too long ago though. So maybe that’s what did it.


#4

See


#5

Same here, using Brackets on OS X

I noted that on https://gohugo.io/overview/quickstart/

it says in Step 6 you don’t even have to use the --watch switch. But that isn’t the case, at least on OS X, and probably for the same reason it doesn’t work with the switch.


#6

switched to another editor (TextSoap) and watch works fine.


#7

I have submitted a patch to fsnotify. With this, watching works perfectly for me in Hugo with TextMate:

It is an obvious bug, so the merge shouldn’t be too long into the future …


#8

I think there may be sometimes something wrong with the system notifications.

hugo serve (–watch) was working fine for me. Until today. I reinstalled older hugo version : sam behaviore, modifications weren’t seen by hugo (even with some older versions that i’m sure were okay previously). Even in --verbose mode, nothing dumped by hugo.

In the end i rebooted my server (x86 server running up-to-date LTS archlinux (4.9.28-1-lts)) (hadn’t been restarted for months …) and after that, everything is working again … (i can see the “INFO 2017/05/18 15:40:58 Received System Events:” logs)

So it seems that there may be some situations where notifications are not forwarded by the system to hugo … maybe something related to the unionfs ?


#9

Ok, here’s the fun part.

15m ago, once server restarted, everywhing was working fine. 10 minutes later, --watch was not working again.

And the problem is … that i’m also running a seafile docker container on the same folder, watching for changes and uploading the modified files on a remote seafile server (so hugo watch was working until i restarted that container !).
If i stop that seafile (cli) container, then hugo start to see the notifications again.
It’s like if the notifications were only able to be sent to either the docker container, either hugo.

The weird part is that the seafile container is configured like that for months, and until recently, this wasn’t an issue. Maybe something has been altered in a recent docker version, i don’t know.