mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 01:08:10 +00:00
Provide compatibility check_output for 2.6 (Fixes #2926)
This commit is contained in:
parent
01ed5c9be3
commit
0a871f6880
2 changed files with 14 additions and 1 deletions
|
@ -6,6 +6,7 @@ from .common import PostProcessor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
check_executable,
|
check_executable,
|
||||||
hyphenate_date,
|
hyphenate_date,
|
||||||
|
subprocess_check_output
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ class XAttrMetadataPP(PostProcessor):
|
||||||
elif user_has_xattr:
|
elif user_has_xattr:
|
||||||
cmd = ['xattr', '-w', key, value, path]
|
cmd = ['xattr', '-w', key, value, path]
|
||||||
|
|
||||||
subprocess.check_output(cmd)
|
subprocess_check_output(cmd)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# On Unix, and can't find pyxattr, setfattr, or xattr.
|
# On Unix, and can't find pyxattr, setfattr, or xattr.
|
||||||
|
|
|
@ -1429,3 +1429,15 @@ def qualities(quality_ids):
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_OUTTMPL = '%(title)s-%(id)s.%(ext)s'
|
DEFAULT_OUTTMPL = '%(title)s-%(id)s.%(ext)s'
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess_check_output = subprocess.check_output
|
||||||
|
except AttributeError:
|
||||||
|
def subprocess_check_output(*args, **kwargs):
|
||||||
|
assert 'input' not in kwargs
|
||||||
|
p = subprocess.Popen(*args, stdout=subprocess.PIPE, **kwargs)
|
||||||
|
output, _ = p.communicate()
|
||||||
|
ret = p.poll()
|
||||||
|
if ret:
|
||||||
|
raise subprocess.CalledProcessError(ret, p.args, output=output)
|
||||||
|
return output
|
||||||
|
|
Loading…
Reference in a new issue