diff options
author | John Hollowell <[email protected]> | 2021-07-05 04:38:54 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-05 10:38:54 +0200 |
commit | 04dc469fbd78d9fe784829f2cba61c8cce982bdb (patch) | |
tree | 020059d5a610783812f09f3858b7b9b34a1c72bf /commands/commands.go | |
parent | 07919d1ccb01733f4c6c5952e59228cecc9b26c8 (diff) | |
download | hugo-04dc469fbd78d9fe784829f2cba61c8cce982bdb.tar.gz hugo-04dc469fbd78d9fe784829f2cba61c8cce982bdb.zip |
commands: Move time notification to after any build errors
This allows error parsers (VSCode problemMatchers) to use the time notification as bounds for detecting errors.
Closes #8403
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 }, }) |