Skip to content

Commit

Permalink
fix(signal): remove call to os.Exit to ensure app cleanups are run
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
arikkfir committed Jul 13, 2024
1 parent 1b6608a commit 2c16379
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ func SetupSignalHandler() context.Context {
go func() {
<-c
cancel()
<-c
os.Exit(1) // second signal. Exit directly.
}()

return ctx
Expand Down

0 comments on commit 2c16379

Please sign in to comment.