This commit is contained in:
a 2025-12-05 16:04:54 -06:00
parent 21e1dae92f
commit 674beaae41
No known key found for this signature in database
GPG key ID: 2F22877AA4DFDADB

View file

@ -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)
}
}()