aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2023-02-23 04:18:45 +0100
committerGitHub <noreply@github.com>2023-02-23 04:18:45 +0100
commitda8e2912b165005f76779a115a071cd6132ceedf (patch)
tree5db3521297764fd3d4b1b9546b8492827448e1c0
parent18d295c9e0f95adc179eef345b7af64d6372db78 (diff)
downloadhypervideo-pre-da8e2912b165005f76779a115a071cd6132ceedf.tar.lz
hypervideo-pre-da8e2912b165005f76779a115a071cd6132ceedf.tar.xz
hypervideo-pre-da8e2912b165005f76779a115a071cd6132ceedf.zip
[utils] `Popen`: Shim undocumented `text_mode` property
Fixes #6317 Authored by: Grub4K
-rw-r--r--yt_dlp/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 994239897..4fe718bf0 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -879,6 +879,7 @@ class Popen(subprocess.Popen):
env = os.environ.copy()
self._fix_pyinstaller_ld_path(env)
+ self.__text_mode = kwargs.get('encoding') or kwargs.get('errors') or text or kwargs.get('universal_newlines')
if text is True:
kwargs['universal_newlines'] = True # For 3.6 compatibility
kwargs.setdefault('encoding', 'utf-8')
@@ -900,7 +901,7 @@ 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''
+ default = '' if proc.__text_mode else b''
stdout, stderr = proc.communicate_or_kill(timeout=timeout)
return stdout or default, stderr or default, proc.returncode