Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hollowell <johnahollowell@gmail.com>2021-07-05 11:38:54 +0300
committerGitHub <noreply@github.com>2021-07-05 11:38:54 +0300
commit04dc469fbd78d9fe784829f2cba61c8cce982bdb (patch)
tree020059d5a610783812f09f3858b7b9b34a1c72bf /commands/commands.go
parent07919d1ccb01733f4c6c5952e59228cecc9b26c8 (diff)
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.go10
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
},
})