diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-07-19 12:20:13 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-07-19 19:50:37 +0200 |
commit | 5bd22ba85f614e0d5cc11f5eecfa4b8227d6b524 (patch) | |
tree | e6c5e7a385369c4a08187affa8ed0f824280d791 /commands | |
parent | 7ae62f4aa384a734faafe2a0918d7a6bc029f0b7 (diff) | |
download | hugo-5bd22ba85f614e0d5cc11f5eecfa4b8227d6b524.tar.gz hugo-5bd22ba85f614e0d5cc11f5eecfa4b8227d6b524.zip |
commands: Delay server builds after the watcher is set up
See #11264
Diffstat (limited to 'commands')
-rw-r--r-- | commands/server.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/commands/server.go b/commands/server.go index 7e6ec5b13..bf82b748d 100644 --- a/commands/server.go +++ b/commands/server.go @@ -470,14 +470,6 @@ func (c *serverCommand) Name() string { } func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error { - err := func() error { - defer c.r.timeTrack(time.Now(), "Built") - err := c.build() - return err - }() - if err != nil { - return err - } // Watch runs its own server as part of the routine if c.serverWatch { @@ -501,6 +493,15 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg } + err := func() error { + defer c.r.timeTrack(time.Now(), "Built") + err := c.build() + return err + }() + if err != nil { + return err + } + return c.serve() } |