mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
this is an awful hack
This commit is contained in:
parent
d47978e06b
commit
8f54cf5b44
1 changed files with 6 additions and 6 deletions
12
caddy.go
12
caddy.go
|
|
@ -750,13 +750,13 @@ func Validate(cfg *Config) error {
|
||||||
// Errors are logged along the way, and an appropriate exit
|
// Errors are logged along the way, and an appropriate exit
|
||||||
// code is emitted.
|
// code is emitted.
|
||||||
func exitProcess(ctx context.Context, logger *zap.Logger) {
|
func exitProcess(ctx context.Context, logger *zap.Logger) {
|
||||||
fmt.Println("exiting")
|
runningInTest := flag.Lookup("test.v") == nil && !strings.Contains(os.Args[0], ".test")
|
||||||
// let the rest of the program know we're quitting; only do it once
|
// let the rest of the program know we're quitting; only do it once
|
||||||
if !atomic.CompareAndSwapInt32(exiting, 0, 1) {
|
if !runningInTest {
|
||||||
fmt.Println("earlly exiting")
|
if !atomic.CompareAndSwapInt32(exiting, 0, 1) {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("doing exiting")
|
|
||||||
|
|
||||||
// give the OS or service/process manager our 2 weeks' notice: we quit
|
// give the OS or service/process manager our 2 weeks' notice: we quit
|
||||||
if err := notify.Stopping(); err != nil {
|
if err := notify.Stopping(); err != nil {
|
||||||
|
|
@ -814,7 +814,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 runningInTest {
|
||||||
os.Exit(exitCode)
|
os.Exit(exitCode)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue