aboutsummaryrefslogtreecommitdiff
path: root/internal/game/owner.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/owner.go')
-rw-r--r--internal/game/owner.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/game/owner.go b/internal/game/owner.go
index d4d3839..3954ab7 100644
--- a/internal/game/owner.go
+++ b/internal/game/owner.go
@@ -172,7 +172,13 @@ func (g *Game) run(fn func()) {
// TestShutdownRejectsSessionInput.
return
}
- <-task
+ select {
+ case <-task:
+ case <-o.done:
+ // The owner goroutine exited without draining the queue (a task
+ // called runtime.Goexit, e.g. a test's t.Fatal). Return instead of
+ // blocking forever on a task that no longer has a consumer.
+ }
}
// adminTaskPanic is the value RunAdminOnOwner re-raises on its caller's
@@ -222,7 +228,12 @@ func (g *Game) RunAdminOnOwner(fn func()) bool {
}) {
return false
}
- <-done
+ select {
+ case <-done:
+ case <-g.owner.done:
+ // Owner goroutine exited; treat as a refused task rather than hanging.
+ return false
+ }
if !finished {
panic(adminTaskPanic)
}