elf_sizes: Popen() universal_newlines and exception syntax (linux)

Change-Id: I9bd658ba6c1ec82c28cd062a9118b74d2a9dd66e
(cherry picked from commit e93dabbc58bcb2c4a93c0eac34d6c5cfc9d1195a)
This commit is contained in:
Mark Charney 2017-06-12 10:31:04 -04:00
parent f5cc39cfe1
commit ea2ea38f3e

View File

@ -39,11 +39,12 @@ def _run_cmd(cmd, die_on_errors=True):
sub = subprocess.Popen(cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT,
universal_newlines=True)
lines = sub.stdout.readlines()
sub.wait()
return (sub.returncode, lines)
except OSError, e:
except OSError as e:
msg = "Execution failed for:" + str( cmd) + ".\nResult is " + str(e)
if die_on_errors:
_die(msg)