diff options
Diffstat (limited to 'sphinx/util/console.py')
-rw-r--r-- | sphinx/util/console.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sphinx/util/console.py b/sphinx/util/console.py index 98563f58e..3ea5b9573 100644 --- a/sphinx/util/console.py +++ b/sphinx/util/console.py @@ -4,7 +4,7 @@ Format colored console output. - :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -32,11 +32,10 @@ def terminal_safe(s: str) -> str: def get_terminal_width() -> int: """Borrowed from the py lib.""" try: - import termios import fcntl import struct - call = fcntl.ioctl(0, termios.TIOCGWINSZ, # type: ignore - struct.pack('hhhh', 0, 0, 0, 0)) + import termios + call = fcntl.ioctl(0, termios.TIOCGWINSZ, struct.pack('hhhh', 0, 0, 0, 0)) height, width = struct.unpack('hhhh', call)[:2] terminal_width = width except Exception: |