From c8523498e74130eec97b252cf54aa5e71a64dc49 Mon Sep 17 00:00:00 2001 From: Arik Kfir Date: Fri, 12 Jul 2024 22:49:26 +0300 Subject: [PATCH] fix(signal): remove call to os.Exit to ensure app cleanups are run This change removes the call to `os.Exit` on a 2nd OS signal, to ensure that the application's cleanups - most often represented as `defer` calls - are properly called (since calls to `os.Exit` prevent `defer` functions execution.) --- signal.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/signal.go b/signal.go index abf656b..fd08df2 100644 --- a/signal.go +++ b/signal.go @@ -37,8 +37,6 @@ func SetupSignalHandler() context.Context { go func() { <-c cancel() - <-c - os.Exit(1) // second signal. Exit directly. }() return ctx