Make terminal UI shutdown idempotent

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 14:30:55 -04:00
committed by Brandon McGinty
parent 41759b95f6
commit 5bf3ed8b84
3 changed files with 30 additions and 9 deletions
+16
View File
@@ -0,0 +1,16 @@
package uiterm
import "testing"
// Regression: Close sent to a bounded channel and could block or enqueue
// duplicate shutdowns when called more than once.
func TestCloseIsNonblockingAndIdempotent(t *testing.T) {
ui := New(nil)
ui.Close()
ui.Close()
select {
case <-ui.close:
default:
t.Fatal("Close did not signal shutdown")
}
}