From c88869778d7fd10360895a954e980f40bff061e8 Mon Sep 17 00:00:00 2001 From: Svarog Date: Thu, 16 Apr 2020 15:03:41 +0300 Subject: [PATCH] [NOD-869] Add a print after os.Exit(1) to see if it is ever called (#701) --- util/panics/panics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/panics/panics.go b/util/panics/panics.go index 4f04e2e75..a99d3d5d0 100644 --- a/util/panics/panics.go +++ b/util/panics/panics.go @@ -24,6 +24,7 @@ func HandlePanic(log *logs.Logger, goroutineStackTrace []byte) { log.Criticalf("Goroutine stack trace: %s", goroutineStackTrace) } log.Criticalf("Stack trace: %s", debug.Stack()) + log.Backend().Close() close(panicHandlerDone) }() @@ -34,8 +35,9 @@ func HandlePanic(log *logs.Logger, goroutineStackTrace []byte) { fmt.Fprintln(os.Stderr, "Couldn't handle a fatal error. Exiting...") case <-panicHandlerDone: } - log.Criticalf("Exiting") + fmt.Print("Exiting...") os.Exit(1) + fmt.Print("After os.Exit(1)") } // GoroutineWrapperFunc returns a goroutine wrapper function that handles panics and writes them to the log.