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:
Cedric Brandily 2014-09-25 14:44:32 +02:00
parent 022610fe86
commit 5aeb94e112
1 changed files with 2 additions and 4 deletions

View File

@ -102,10 +102,8 @@ class Runner(object):
shlex.split('docker images'),
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = process.communicate()
if len(out) == 0 or not out[0] or not out[0].strip():
out_text = ''
out_text = out[0].strip().decode('utf-8')
stdout, _ = process.communicate()
out_text = stdout.strip().decode('utf-8') if stdout else ""
return dict([f.split()[:2] for f in out_text.split('\n')])
def have_test_image(self):