We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3479752 + 25e5472 commit f95aba0Copy full SHA for f95aba0
1 file changed
pbar.py
@@ -65,7 +65,7 @@ def get_terminal_width():
65
def ioctl_gwinsz(fd):
66
"""Gets the windows size for a given file descriptor"""
67
try:
68
- return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
+ return termios.tcgetwinsize(fd)
69
except BaseException:
70
return None
71
@@ -78,6 +78,9 @@ def ioctl_gwinsz(fd):
78
79
return None, None, None, None
80
81
+ if window_size is None:
82
+ return None, None, None, None
83
+
84
return int(window_size[1]), int(window_size[0]), 0, 0
85
86
def bold(text):
0 commit comments