0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-10 00:25:06 +00:00

[utils] Popen.run: Fix default return in binary mode

This commit is contained in:
pukkandan 2022-09-26 02:52:21 +05:30
parent ab029d7e92
commit 914491b8e0
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39

View file

@ -891,8 +891,9 @@ def kill(self, *, timeout=0):
@classmethod @classmethod
def run(cls, *args, timeout=None, **kwargs): def run(cls, *args, timeout=None, **kwargs):
with cls(*args, **kwargs) as proc: with cls(*args, **kwargs) as proc:
default = '' if proc.text_mode else b''
stdout, stderr = proc.communicate_or_kill(timeout=timeout) stdout, stderr = proc.communicate_or_kill(timeout=timeout)
return stdout or '', stderr or '', proc.returncode return stdout or default, stderr or default, proc.returncode
def get_subprocess_encoding(): def get_subprocess_encoding():