mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-13 22:36:27 +03: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")
|
logger.Error("unclean shutdown")
|
||||||
}
|
}
|
||||||
// check if we are in test environment, and dont call exit if we are
|
// 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)
|
os.Exit(exitCode)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
@ -257,6 +258,7 @@ func cmdRun(fl Flags) (int, error) {
|
||||||
|
|
||||||
// if enabled, reload config file automatically on changes
|
// if enabled, reload config file automatically on changes
|
||||||
// (this better only be used in dev!)
|
// (this better only be used in dev!)
|
||||||
|
// do not enable this during tests, it will cause leaks
|
||||||
if watchFlag {
|
if watchFlag {
|
||||||
go watchConfigFile(configFile, configAdapterFlag)
|
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) {
|
func cmdStop(fl Flags) (int, error) {
|
||||||
|
|
Loading…
Reference in a new issue