Skip to content

Commit

Permalink
fix: unconditionally execute ExitFunc when calling Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Apr 11, 2022
1 parent 4c48240 commit c0f60e5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions atexit.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,9 @@ var ExitDelay = time.Millisecond * 100

// Exit calls the exit functions in reverse and the program exits with the code.
func Exit(code int) {
if executed := execute(); executed {
if ExitDelay > 0 {
time.Sleep(ExitDelay)
}
ExitFunc(code)
execute()
if ExitDelay > 0 {
time.Sleep(ExitDelay)
}
ExitFunc(code)
}

0 comments on commit c0f60e5

Please sign in to comment.