aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands/commandeer.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-03-18 08:54:44 +0100
committerBjørn Erik Pedersen <[email protected]>2022-03-21 09:32:35 +0100
commit9539069f5eb5f5abbd7138eda10893353d0c5eea (patch)
tree576a583ab532525c66a113e5945fb9d1bdf5485e /commands/commandeer.go
parent0e305d695820779a5c66fbe3434e3293911d7f98 (diff)
downloadhugo-9539069f5eb5f5abbd7138eda10893353d0c5eea.tar.gz
hugo-9539069f5eb5f5abbd7138eda10893353d0c5eea.zip
commands: Improve server startup to make tests less flaky
Do this by announcing/listen on the local address before we start the server.
Diffstat (limited to 'commands/commandeer.go')
-rw-r--r--commands/commandeer.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index 507ec430d..8a1925893 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -17,6 +17,7 @@ import (
"bytes"
"errors"
"io/ioutil"
+ "net"
"os"
"path/filepath"
"regexp"
@@ -88,7 +89,8 @@ type commandeer struct {
// Used in cases where we get flooded with events in server mode.
debounce func(f func())
- serverPorts []int
+ serverPorts []serverPortListener
+
languagesConfigured bool
languages langs.Languages
doLiveReload bool
@@ -105,6 +107,11 @@ type commandeer struct {
buildErr error
}
+type serverPortListener struct {
+ p int
+ ln net.Listener
+}
+
func newCommandeerHugoState() *commandeerHugoState {
return &commandeerHugoState{
created: make(chan struct{}),
@@ -420,6 +427,7 @@ func (c *commandeer) loadConfig() error {
if h == nil || c.failOnInitErr {
err = createErr
}
+
c.hugoSites = h
// TODO(bep) improve.
if c.buildLock == nil && h != nil {