mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 22:50:35 +03:00
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
This commit is contained in:
parent
07919d1ccb
commit
04dc469fbd
3 changed files with 29 additions and 7 deletions
|
@ -236,12 +236,24 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
|
|||
jww.WARN.Println("memstats error:", err)
|
||||
}
|
||||
|
||||
// silence errors in cobra so we can handle them here
|
||||
cmd.SilenceErrors = true
|
||||
|
||||
c, err := initializeConfig(true, true, &sc.hugoBuilderCommon, sc, cfgInit)
|
||||
if err != nil {
|
||||
cmd.PrintErrln("Error:", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.serverBuild(); err != nil {
|
||||
err = func() error {
|
||||
defer c.timeTrack(time.Now(), "Built")
|
||||
err := c.serverBuild()
|
||||
if err != nil {
|
||||
cmd.PrintErrln("Error:", err.Error())
|
||||
}
|
||||
return err
|
||||
}()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue