1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-28 10:46:15 +01:00

Merge branch 'return_external_2.6_compat' of https://github.com/lethliel/osc

Workaround for python26 due to missing subprocess.check_output.

Fixes: #355 ("subprocess.check_output() not in Python 2.6")
This commit is contained in:
Marcus Huewe 2017-11-21 14:25:55 +01:00
commit 03c25eb8f9

View File

@ -7572,6 +7572,16 @@ def return_external(filename, *args, **kwargs):
cmd = filename
try:
# backward compatibility for python 2.6
if 'check_output' not in dir(subprocess):
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output, errstr = process.communicate()
retcode = process.poll()
if retcode:
error = subprocess.CalledProcessError(retcode, cmd)
error.output = output
raise error
return output
return subprocess.check_output(cmd, **kwargs)
except OSError as e:
if e.errno != errno.ENOENT: