Skip to content

Commit f95aba0

Browse files
committed
Merge branch 'morpheus' into 'master'
* morpheus: MB-70730 Fix crash from progress bar getting win size Change-Id: I6f1a332bbfe97f02e6d994d2ef9d6b22b376abf6
2 parents 3479752 + 25e5472 commit f95aba0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pbar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def get_terminal_width():
6565
def ioctl_gwinsz(fd):
6666
"""Gets the windows size for a given file descriptor"""
6767
try:
68-
return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
68+
return termios.tcgetwinsize(fd)
6969
except BaseException:
7070
return None
7171

@@ -78,6 +78,9 @@ def ioctl_gwinsz(fd):
7878
except BaseException:
7979
return None, None, None, None
8080

81+
if window_size is None:
82+
return None, None, None, None
83+
8184
return int(window_size[1]), int(window_size[0]), 0, 0
8285

8386
def bold(text):

0 commit comments

Comments
 (0)