Skip to content

Commit 98b5460

Browse files
authored
Update render50
1 parent 3485344 commit 98b5460

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

render50

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,7 @@ def concatenate(output, inputs):
381381

382382
def cprint(text="", color=None, on_color=None, attrs=None, end="\n"):
383383
"""Colorize text (and wraps to terminal's width)."""
384-
385-
# Assume 80 in case not running in a terminal
386-
columns, _ = get_terminal_size_fallback()
387-
if columns == 0:
388-
columns = 80
389-
390-
# Print text, flushing output
384+
columns, _ = shutil.get_terminal_size()
391385
termcolor.cprint(fill(text, columns, drop_whitespace=False, replace_whitespace=False),
392386
color=color, on_color=on_color, attrs=attrs, end=end)
393387
sys.stdout.flush()
@@ -444,16 +438,6 @@ def get(file):
444438
raise RuntimeError("Could not read {}.".format(file))
445439

446440

447-
def get_terminal_size_fallback():
448-
try:
449-
# Attempt to get terminal size
450-
columns, _ = os.get_terminal_size()
451-
except OSError:
452-
# Fallback to default size if running in a non-terminal environment
453-
columns, _ = shutil.get_terminal_size(fallback=(80, 20))
454-
return columns
455-
456-
457441
def join(a, b):
458442
"""Join a and b, where each is a URL, an absolute path, or a relative path."""
459443

0 commit comments

Comments
 (0)