aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/commandfuncs.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r--cmd/commandfuncs.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go
index 746cf3da6..bdee24d11 100644
--- a/cmd/commandfuncs.go
+++ b/cmd/commandfuncs.go
@@ -20,6 +20,7 @@ import (
"crypto/rand"
"encoding/json"
"errors"
+ "flag"
"fmt"
"io"
"io/fs"
@@ -257,6 +258,7 @@ func cmdRun(fl Flags) (int, error) {
// if enabled, reload config file automatically on changes
// (this better only be used in dev!)
+ // do not enable this during tests, it will cause leaks
if watchFlag {
go watchConfigFile(configFile, configAdapterFlag)
}
@@ -280,7 +282,11 @@ func cmdRun(fl Flags) (int, error) {
}
}
- select {}
+ if flag.Lookup("test.v") == nil || !strings.Contains(os.Args[0], ".test") {
+ return caddy.ExitCodeSuccess, nil
+ } else {
+ select {}
+ }
}
func cmdStop(fl Flags) (int, error) {