Handle get_terminal_size() returning 0 (fixes #106)

This commit is contained in:
Dirk Reiners 2018-04-20 19:18:43 -05:00 committed by Tobias Gruetzmacher
parent b2fdc13feb
commit fbd2ac2246

View file

@ -127,7 +127,10 @@ class Output(object):
if not self.is_tty:
return self.DEFAULT_WIDTH
try:
return get_terminal_size().columns
w = get_terminal_size().columns
if w <= 0:
return self.DEFAULT_WIDTH
return w
except ValueError:
return self.DEFAULT_WIDTH