Skip to content

Commit

Permalink
Update terminal.py
Browse files Browse the repository at this point in the history
Changed the if, elif, else logic for get_terminal_size(). When I am testing code in an IDE on Windows, the typical Windows code fails to work and get_terminal_size() returns None--which throws an exception later in the code. The quick fix is to modify the logic so that if we don't have a method for determining the terminal size OR if any of our known methods fail, we just assume a standard terminal. It might be better to add more error handling downstream of this method in the execution, but assuming a standard terminal definitely seems like a 'good enough' solution to me.
  • Loading branch information
dbotwinick committed Jun 15, 2014
1 parent 5e3beb9 commit d459929
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plumbum/cli/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def get_terminal_size():
size = _get_terminal_size_tput()
elif current_os in ('Linux', 'Darwin', 'FreeBSD') or current_os.startswith('CYGWIN'):
size = _get_terminal_size_linux()
else:

if size is None: # we'll assume the standard 80x25 if for any reason we don't know the terminal size
size = (80, 25)
return size

Expand Down

0 comments on commit d459929

Please sign in to comment.