From 914491b8e087d21b8a1714eb185008c29b6fe1e8 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 26 Sep 2022 02:52:21 +0530 Subject: [PATCH] [utils] `Popen.run`: Fix default return in binary mode --- yt_dlp/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index bc100c9c3..f93573692 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -891,8 +891,9 @@ class Popen(subprocess.Popen): @classmethod def run(cls, *args, timeout=None, **kwargs): with cls(*args, **kwargs) as proc: + default = '' if proc.text_mode else b'' 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():