Skip to content

Commit e82b4fc

Browse files
committed
Handle OSError from unit tests
1 parent 5f070f4 commit e82b4fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,12 @@ def __init__(
464464

465465
# as long as the first event received is a window resize event,
466466
# this works fine...
467-
self.width, self.height = os.get_terminal_size()
467+
try:
468+
self.width, self.height = os.get_terminal_size()
469+
except OSError:
470+
# this case will trigger during unit tests when stdout is redirected
471+
self.width = -1
472+
self.height = -1
468473

469474
self.status_bar.message(banner)
470475

0 commit comments

Comments
 (0)