Skip to content

Commit cd4ac7e

Browse files
committed
Switch to using shutil.get_terminal_size() for compatibility
1 parent 6d34d1a commit cd4ac7e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

common/output_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Utility functions related to terminal output."""
22

3-
import os
43
import re
4+
import shutil
55
from textwrap import TextWrapper
66
from typing import Any
77

@@ -34,7 +34,7 @@ def terminal_columns() -> int:
3434
terminal environment variables then DEFAULT_TERMINAL_COLUMNS we be returned.
3535
"""
3636
try:
37-
columns = os.get_terminal_size().columns or DEFAULT_TERMINAL_COLUMNS
37+
columns = shutil.get_terminal_size().columns or DEFAULT_TERMINAL_COLUMNS
3838
except OSError:
3939
columns = DEFAULT_TERMINAL_COLUMNS
4040

@@ -88,7 +88,7 @@ def clear_page() -> None:
8888
printing the next information.
8989
"""
9090
try:
91-
num_lines = os.get_terminal_size().lines
91+
num_lines = shutil.get_terminal_size().lines
9292
except OSError:
9393
num_lines = DEFAULT_TERMINAL_LINES
9494

common/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Utility functions."""
22

3-
import os
3+
import shutil
44
from argparse import ArgumentTypeError
55
from typing import List, Tuple
66

@@ -22,7 +22,7 @@
2222

2323

2424
def terminal_columns() -> int:
25-
return os.get_terminal_size().columns or DEFAULT_TERMINAL_COLUMNS
25+
return shutil.get_terminal_size().columns or DEFAULT_TERMINAL_COLUMNS
2626

2727

2828
def address_to_filename(target: SBTarget, address: int) -> str:

0 commit comments

Comments
 (0)