Simplify Popen.communicate() result parsing
Popen.communicate returns a tuple (stdoutdata, stderrdata) which implies the result length check is useless. Change-Id: Id5ee7328d8e31bf584c9069183213cc8c2a19da1
This commit is contained in:
parent
022610fe86
commit
5aeb94e112
|
@ -102,10 +102,8 @@ class Runner(object):
|
||||||
shlex.split('docker images'),
|
shlex.split('docker images'),
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
out = process.communicate()
|
stdout, _ = process.communicate()
|
||||||
if len(out) == 0 or not out[0] or not out[0].strip():
|
out_text = stdout.strip().decode('utf-8') if stdout else ""
|
||||||
out_text = ''
|
|
||||||
out_text = out[0].strip().decode('utf-8')
|
|
||||||
return dict([f.split()[:2] for f in out_text.split('\n')])
|
return dict([f.split()[:2] for f in out_text.split('\n')])
|
||||||
|
|
||||||
def have_test_image(self):
|
def have_test_image(self):
|
||||||
|
|
Loading…
Reference in New Issue