Skip to content

Commit 25e5472

Browse files
committed
MB-70730 Merge branch 'trinity' into 'morpheus'
* trinity: MB-70730 Fix crash from progress bar getting win size Change-Id: I4e58e87674b2a44507b59d23336c8f9a654ae634
2 parents 89a229c + f3ab16c commit 25e5472

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)