utils: fix error in runcmd() if printerr=False

If you specified printerr=False we were referring to the output variable
that hadn't been set. Looks like I broke this back in 2013 in
93ce26f21c.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2016-11-07 15:14:24 +13:00
parent 002b7c1782
commit cc1d82f893

View File

@ -190,9 +190,9 @@ def runcmd(cmd, destdir=None, printerr=True, logger=None):
subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True)
except subprocess.CalledProcessError as e:
out.seek(0)
if printerr:
output = out.read()
output = output.decode('ascii').strip()
if printerr:
if logger:
logger.error("%s" % output)
else: