Skip to content

Commit

Permalink
Merge pull request #997 from H1SWarrior/get_winterm_size
Browse files Browse the repository at this point in the history
Rebased fix to get_winterm_size() returning (0, 0)
  • Loading branch information
Dan Sully authored May 14, 2018
2 parents 21d5125 + f816faf commit d2818ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion click/termui.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ def get_terminal_size():
sz = shutil_get_terminal_size()
return sz.columns, sz.lines

# We provide a sensible default for get_winterm_size() when being invoked
# inside a subprocess. Without this, it would not provide a useful input.
if get_winterm_size is not None:
return get_winterm_size()
size = get_winterm_size()
if size == (0, 0):
return (79, 24)
else:
return size

def ioctl_gwinsz(fd):
try:
Expand Down

0 comments on commit d2818ec

Please sign in to comment.