diff --git a/render50 b/render50 index bc70a17..613412d 100755 --- a/render50 +++ b/render50 @@ -381,13 +381,7 @@ def concatenate(output, inputs): def cprint(text="", color=None, on_color=None, attrs=None, end="\n"): """Colorize text (and wraps to terminal's width).""" - - # Assume 80 in case not running in a terminal - columns, _ = get_terminal_size_fallback() - if columns == 0: - columns = 80 - - # Print text, flushing output + columns, _ = shutil.get_terminal_size() termcolor.cprint(fill(text, columns, drop_whitespace=False, replace_whitespace=False), color=color, on_color=on_color, attrs=attrs, end=end) sys.stdout.flush() @@ -444,16 +438,6 @@ def get(file): raise RuntimeError("Could not read {}.".format(file)) -def get_terminal_size_fallback(): - try: - # Attempt to get terminal size - columns, rows = os.get_terminal_size() - except OSError: - # Fallback to default size if running in a non-terminal environment - columns, rows = shutil.get_terminal_size(fallback=(80, 20)) - return columns, rows - - def join(a, b): """Join a and b, where each is a URL, an absolute path, or a relative path.""" diff --git a/setup.py b/setup.py index cf0266e..491e859 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,5 @@ python_requires=">=3.9", scripts=["render50"], url="https://github.com/cs50/render50", - version="9.2.7" + version="9.2.8" )