Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
os.Exit() does not run deferred fns
Browse files Browse the repository at this point in the history
  • Loading branch information
miparnisari committed Feb 19, 2024
1 parent 377e338 commit d14b32e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ func TestMain(m *testing.M) {
fmt.Println(err)
os.Exit(1)
}
defer cluster.Stop()
os.Exit(m.Run())
code := m.Run()
cluster.Stop()

// os.Exit doesn't run deferred functions
os.Exit(code)
}

func TestOverTheLimit(t *testing.T) {
Expand Down

0 comments on commit d14b32e

Please sign in to comment.