mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 07:06:13 +01:00
added compat code for python 2.6
if subprocess has no method check_output us Popen instead
This commit is contained in:
parent
3c1bb1cf0a
commit
7581856d9b
10
osc/core.py
10
osc/core.py
@ -7567,6 +7567,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:
|
||||
|
Loading…
Reference in New Issue
Block a user