From ea2ea38f3eae32040f4d4ea465106300a7804b2b Mon Sep 17 00:00:00 2001 From: Mark Charney Date: Mon, 12 Jun 2017 10:31:04 -0400 Subject: [PATCH] elf_sizes: Popen() universal_newlines and exception syntax (linux) Change-Id: I9bd658ba6c1ec82c28cd062a9118b74d2a9dd66e (cherry picked from commit e93dabbc58bcb2c4a93c0eac34d6c5cfc9d1195a) --- scripts/elf_sizes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/elf_sizes.py b/scripts/elf_sizes.py index 2de6674..6136c81 100755 --- a/scripts/elf_sizes.py +++ b/scripts/elf_sizes.py @@ -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)