A feature-rich command-line audio/video downloader
[utils] `write_string`: Fix noconsole behavior
Simon Sawicki3b479100df02
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex e9b8894473..8c2c5593cc 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -2057,6 +2057,9 @@ def get_windows_version():def write_string(s, out=None, encoding=None):assert isinstance(s, str)out = out or sys.stderr+ # `sys.stderr` might be `None` (Ref: https://github.com/pyinstaller/pyinstaller/pull/7217)+ if not out:+ returnif compat_os_name == 'nt' and supports_terminal_sequences(out):s = re.sub(r'([\r\n]+)', r' \1', s)