internal/testing: avoid os.Exit(0)

os.Exit(0) might cause test flakiness.

https://github.com/hajimehoshi/ebiten/actions/runs/10650734256/job/29522689113

```
panic: unexpected call to os.Exit(0) during test

goroutine 1 [running]:
os.Exit(0x0)
	/opt/hostedtoolcache/go/1.23.0/x64/src/os/proc.go:67 +0x8
github.com/hajimehoshi/ebiten/v2/internal/testing.MainWithRunLoop(0x19b28c0)
	/home/runner/work/ebiten/ebiten/internal/testing/testing.go:50 +0xa
github.com/hajimehoshi/ebiten/v2/internal/graphicscommand_test.TestMain(...)
	/home/runner/work/ebiten/ebiten/internal/graphicscommand/image_test.go:42
main.main()
	_testmain.go:55 +0x5
```
This commit is contained in:
Hajime Hoshi 2024-09-01 13:31:37 +09:00
parent faeb03373d
commit 67441c4823

View File

@ -47,5 +47,7 @@ func MainWithRunLoop(m *testing.M) {
if err := ebiten.RunGame(g); err != nil { if err := ebiten.RunGame(g); err != nil {
panic(err) panic(err)
} }
os.Exit(g.code) if g.code != 0 {
os.Exit(g.code)
}
} }