Skip to content

Commit 3a159bc

Browse files
author
Chris Pine
authored
do not crash if termbox fails to init (#290)
1 parent 11a4ba6 commit 3a159bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/output/capabilities.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ func detectCapabilities() capabilities {
2323
// Pulling in termbox is probably overkill, but finding a pure Go library
2424
// that could just provide terminfo was surprisingly hard. At least termbox
2525
// is widely used.
26-
if err := termbox.Init(); err != nil {
27-
panic(err)
26+
w, h := 80, 25
27+
if err := termbox.Init(); err == nil {
28+
w, h = termbox.Size()
29+
termbox.Close()
2830
}
29-
w, h := termbox.Size()
30-
termbox.Close()
3131

3232
atty := isatty.IsTerminal(os.Stdout.Fd())
3333

0 commit comments

Comments
 (0)