mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-12-14 23:11:04 +00:00
fix: os.Exit() kills any deferred cleanup functions
os.Exit() itself is now also a deferred function, which will be the last to run.
This commit is contained in:
@@ -14,6 +14,11 @@ var (
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
ret := 1
|
||||
defer func() {
|
||||
os.Exit(ret)
|
||||
}()
|
||||
|
||||
r, err := miniredis.Run()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -26,7 +31,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
defer rh.Close()
|
||||
|
||||
os.Exit(m.Run())
|
||||
ret = m.Run()
|
||||
}
|
||||
|
||||
func TestRedisLogin(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user