internal/processtest: fix the timeout logic

Updates #2571
This commit is contained in:
Hajime Hoshi 2023-02-15 22:41:18 +09:00
parent 5038b8b645
commit 7018d1aebe

View File

@ -43,17 +43,17 @@ func (g *Game) Layout(width, height int) (int, int) {
done := make(chan struct{}) done := make(chan struct{})
timeout := time.After(time.Second) timeout := time.After(time.Second)
go func() { go func() {
select { i := ebiten.NewImage(width, height)
case <-done: i.Fill(color.White)
case <-timeout: i.Dispose()
panic("timeout") close(done)
}
}() }()
defer close(done)
i := ebiten.NewImage(width, height) select {
i.Fill(color.White) case <-done:
i.Dispose() case <-timeout:
panic("timeout")
}
return width, height return width, height
} }