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