diff options
author | John Hollowell <johnahollowell@gmail.com> | 2021-07-05 04:38:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 10:38:54 +0200 |
commit | 04dc469fbd78d9fe784829f2cba61c8cce982bdb (patch) | |
tree | 020059d5a610783812f09f3858b7b9b34a1c72bf /commands/server.go | |
parent | 07919d1ccb01733f4c6c5952e59228cecc9b26c8 (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/server.go')
-rw-r--r-- | commands/server.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/commands/server.go b/commands/server.go index 5c8c778d4..09cf43b24 100644 --- a/commands/server.go +++ b/commands/server.go @@ -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 } |