mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 13:13:06 +00:00
[utils] write_string
: Fix noconsole behavior
Ref: https://github.com/pyinstaller/pyinstaller/pull/7217 Authored by: Grub4K
This commit is contained in:
parent
d4e6ef4077
commit
3b479100df
@ -2057,6 +2057,9 @@ def get_windows_version():
|
|||||||
def write_string(s, out=None, encoding=None):
|
def write_string(s, out=None, encoding=None):
|
||||||
assert isinstance(s, str)
|
assert isinstance(s, str)
|
||||||
out = out or sys.stderr
|
out = out or sys.stderr
|
||||||
|
# `sys.stderr` might be `None` (Ref: https://github.com/pyinstaller/pyinstaller/pull/7217)
|
||||||
|
if not out:
|
||||||
|
return
|
||||||
|
|
||||||
if compat_os_name == 'nt' and supports_terminal_sequences(out):
|
if compat_os_name == 'nt' and supports_terminal_sequences(out):
|
||||||
s = re.sub(r'([\r\n]+)', r' \1', s)
|
s = re.sub(r'([\r\n]+)', r' \1', s)
|
||||||
|
Loading…
Reference in New Issue
Block a user