commands: Delay server builds after the watcher is set up

See #11264
This commit is contained in:
Bjørn Erik Pedersen 2023-07-19 12:20:13 +02:00
parent 7ae62f4aa3
commit 5bd22ba85f

View file

@ -470,14 +470,6 @@ func (c *serverCommand) Name() string {
} }
func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error { 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 // Watch runs its own server as part of the routine
if c.serverWatch { 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() return c.serve()
} }