mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-01 01:03:04 +01:00
[utils] Popen
: Shim undocumented text_mode
property
Fixes #6317 Authored by: Grub4K
This commit is contained in:
parent
18d295c9e0
commit
da8e2912b1
@ -879,6 +879,7 @@ def __init__(self, *args, env=None, text=False, **kwargs):
|
|||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
self._fix_pyinstaller_ld_path(env)
|
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:
|
if text is True:
|
||||||
kwargs['universal_newlines'] = True # For 3.6 compatibility
|
kwargs['universal_newlines'] = True # For 3.6 compatibility
|
||||||
kwargs.setdefault('encoding', 'utf-8')
|
kwargs.setdefault('encoding', 'utf-8')
|
||||||
@ -900,7 +901,7 @@ 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''
|
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 default, stderr or default, proc.returncode
|
return stdout or default, stderr or default, proc.returncode
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user