diff options
Diffstat (limited to 'commands/commands.go')
-rw-r--r-- | commands/commands.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/commands.go b/commands/commands.go index 235f35917..c4d37ab3e 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -162,13 +162,21 @@ Complete documentation is available at http://gohugo.io/.`, return nil } + // prevent cobra printing error so it can be handled here (before the timeTrack prints) + cmd.SilenceErrors = true + c, err := initializeConfig(true, cc.buildWatch, &cc.hugoBuilderCommon, cc, cfgInit) if err != nil { + cmd.PrintErrln("Error:", err.Error()) return err } cc.c = c - return c.build() + err = c.build() + if err != nil { + cmd.PrintErrln("Error:", err.Error()) + } + return err }, }) |