Hugo on Solaris like systems, issue with no fsnotify support

Hi,

I just built “hugo”, but it seems that on Solaris (and Solaris like system I use SmartOS) it won’t work due to lack of capabilities in fsnotify.

Is there any way to run “hugo” without file system notification features?

Why does “hugo” even need fsnotify at all? I mean it does serve static sites right?

# mkdir hugo
# cd hugo
# go get -v github.com/gohugoio/hugo
# hugo version
Hugo Static Site Generator v0.27-DEV solaris/amd64 BuildDate: 2017-08-30T00:03:11Z

My error message, and note I did not pass a -w flag.

#hugo server
2017/08/30 00:09:57 FEN based watcher not yet supported for fsnotify

Solaris, SmartOS, Openindiana, OmniOS, and Tribblix all will the same FEN watcher fsnotify issue.

From https://fsnotify.org/ I see that

Peter Krnjevic recently informed me of Windows USN Journals – it could
be worth exploring. Then there is FEN for Solaris – we haven’t even started
implementing that.

Hopefully I can run “hugo” without loading a Linux Kernel in a KVM (that’s possible) as I prefer if possible to stay with native SmartOS zones.

Thanks

Jon Strabala

 -w, --watch                      watch filesystem for changes and recreate as needed (default true)

Watch in server is default true, so set that to false.

Hi bep,

Thanks for looking at this, however note when I run “hugo -h” merely says the following, there is no “(default true) as such it’s seems like it is implicitly false”.

-w, --watch watch filesystem for changes and recreate as needed

If your correct about the sense of the boolean then the “hugo -h” help message should be fixed. But It looks like ‘-w’ or ‘–watch’ is initialized to false in ./src/github.com/gohugoio/hugo/commands/hugo.go

HugoCmd.Flags().BoolVarP(&buildWatch, “watch”, “w”, false, “watch filesystem for changes and recreate as needed”)

Regardless I get the same error with or without the -w flag when I try to start the web server.

hugo -w server
2017/08/30 12:59:53 FEN based watcher not yet supported for fsnotify
hugo server
2017/08/30 12:59:58 FEN based watcher not yet supported for fsnotify

The error message comes from ./go/src/github.com/fsnotify/fsnotify/fen.go

// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
func NewWatcher() (*Watcher, error) {
return nil, errors.New(“FEN based watcher not yet supported for fsnotify\n”)
}

And in ./src/github.com/spf13/viper/viper.go (which I believe is invoked from the “hugo server” command) the above is called from WatchConfig(), this will always exit if called.

As I said: The default is true so you have to explicitly set the flag to false.

You would have to hugo server -h to get the correct help.

I am pretty sure the default is ‘false’ from inspecting the code and this is consistent with the help message from ‘hugo -h’

I’m usually right about these things, but if you don’t want to listen to me, I suggest you either 1) wait for Solaris support 2) Use Linux or similar.