commands: Delay server builds after the watcher is set up - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 5bd22ba85f614e0d5cc11f5eecfa4b8227d6b524
DIR parent 7ae62f4aa384a734faafe2a0918d7a6bc029f0b7
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Wed, 19 Jul 2023 12:20:13 +0200
commands: Delay server builds after the watcher is set up
See #11264
Diffstat:
M commands/server.go | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
---
DIR diff --git 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()
}