aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-05-16 12:03:59 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-05-16 12:03:59 +0200
commit0a871f68805b0edda7ebc6a357c4ff8aae514758 (patch)
treea44e2022756d18ce5796d48920c027987dbb2538 /youtube_dl/utils.py
parent01ed5c9be30a98d3d8bc9eeb4240ce69d4b5c1ae (diff)
Provide compatibility check_output for 2.6 (Fixes #2926)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 1036ea9bd..aa9347f43 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1429,3 +1429,15 @@ def qualities(quality_ids):
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