mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
noot
This commit is contained in:
parent
01cb878087
commit
b491fc5d6c
2 changed files with 8 additions and 2 deletions
2
caddy.go
2
caddy.go
|
@ -780,7 +780,7 @@ func exitProcess(ctx context.Context, logger *zap.Logger) {
|
|||
logger.Error("unclean shutdown")
|
||||
}
|
||||
// check if we are in test environment, and dont call exit if we are
|
||||
if flag.Lookup("test.v") == nil || !strings.Contains(os.Args[0], ".test") {
|
||||
if flag.Lookup("test.v") == nil && !strings.Contains(os.Args[0], ".test") {
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
}()
|
||||
|
|
|
@ -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) {
|
|||
}
|
||||
}
|
||||
|
||||
if flag.Lookup("test.v") == nil || !strings.Contains(os.Args[0], ".test") {
|
||||
return caddy.ExitCodeSuccess, nil
|
||||
} else {
|
||||
select {}
|
||||
}
|
||||
}
|
||||
|
||||
func cmdStop(fl Flags) (int, error) {
|
||||
|
|
Loading…
Reference in a new issue