summaryrefslogtreecommitdiffstats
path: root/commands/hugobuilder.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/hugobuilder.go')
-rw-r--r--commands/hugobuilder.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go
index 41f42ae6d..ddc92129c 100644
--- a/commands/hugobuilder.go
+++ b/commands/hugobuilder.go
@@ -361,34 +361,32 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
return watcher, nil
}
-func (c *hugoBuilder) build() error {
+func (c *hugoBuilder) build() (func(), error) {
stopProfiling, err := c.initProfiling()
if err != nil {
- return err
+ return nil, err
}
- defer func() {
- if stopProfiling != nil {
- stopProfiling()
- }
- }()
-
if err := c.fullBuild(false); err != nil {
- return err
+ return nil, err
}
if !c.r.quiet {
c.r.Println()
h, err := c.hugo()
if err != nil {
- return err
+ return nil, err
}
h.PrintProcessingStats(os.Stdout)
c.r.Println()
}
- return nil
+ return func() {
+ if stopProfiling != nil {
+ stopProfiling()
+ }
+ }, nil
}
func (c *hugoBuilder) buildSites(noBuildLock bool) (err error) {