summaryrefslogtreecommitdiffstats
path: root/commands/hugo.go
diff options
context:
space:
mode:
authorJohn Hollowell <johnahollowell@gmail.com>2021-07-05 04:38:54 -0400
committerGitHub <noreply@github.com>2021-07-05 10:38:54 +0200
commit04dc469fbd78d9fe784829f2cba61c8cce982bdb (patch)
tree020059d5a610783812f09f3858b7b9b34a1c72bf /commands/hugo.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/hugo.go')
-rw-r--r--commands/hugo.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 86aa8d573..0f6e4274a 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -539,7 +539,6 @@ func (c *commandeer) build() error {
}
func (c *commandeer) serverBuild() error {
- defer c.timeTrack(time.Now(), "Built")
stopProfiling, err := c.initProfiling()
if err != nil {
@@ -737,7 +736,6 @@ func (c *commandeer) handleBuildErr(err error, msg string) {
}
func (c *commandeer) rebuildSites(events []fsnotify.Event) error {
- defer c.timeTrack(time.Now(), "Total")
c.buildErr = nil
visited := c.visitedURLs.PeekAllSet()
@@ -1124,9 +1122,13 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher,
c.printChangeDetected("")
c.changeDetector.PrepareNew()
- if err := c.rebuildSites(dynamicEvents); err != nil {
- c.handleBuildErr(err, "Rebuild failed")
- }
+
+ func() {
+ defer c.timeTrack(time.Now(), "Total")
+ if err := c.rebuildSites(dynamicEvents); err != nil {
+ c.handleBuildErr(err, "Rebuild failed")
+ }
+ }()
if doLiveReload {
if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 {