From 98b54609cdc73dce8533225c2bfbc8d3756065c0 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Tue, 27 May 2025 08:00:45 -0400 Subject: [PATCH 1/2] Update render50 --- render50 | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/render50 b/render50 index d2a24cc..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, _ = os.get_terminal_size() - except OSError: - # Fallback to default size if running in a non-terminal environment - columns, _ = shutil.get_terminal_size(fallback=(80, 20)) - return columns - - def join(a, b): """Join a and b, where each is a URL, an absolute path, or a relative path.""" From 019c26edcc94c23abf70c67a0a21b294d033a288 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Tue, 27 May 2025 08:02:29 -0400 Subject: [PATCH 2/2] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" )