Skip to content

Commit f02532a

Browse files
authored
Merge pull request #7583 from harmim/bugfixes/ls-parse
Avoid deadlock in the `ls_parse.py` script
2 parents 88e3145 + 0eebd6d commit f02532a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/ls_parse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ def symbols_from(object_file):
379379
cmd = ["objdump", "--syms", object_file]
380380
proc = subprocess.Popen(cmd, universal_newlines=True,
381381
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
382-
if proc.wait():
383-
logging.error("`%s` failed. Output:\n%s", " ".join(cmd),
384-
proc.stdout.read())
382+
proc_output, _ = proc.communicate()
383+
if proc.returncode:
384+
logging.error("`%s` failed. Output:\n%s", " ".join(cmd), proc_output)
385385
exit(1)
386386
pat = re.compile(r"(?P<addr>[^\s]+)\s+"
387387
r"(?P<flags>[lgu! ][w ][C ][W ][Ii ][Dd ][FfO ])\s+"
@@ -391,7 +391,7 @@ def symbols_from(object_file):
391391
)
392392
matching = False
393393
ret = {}
394-
for line in proc.stdout.read().splitlines():
394+
for line in proc_output.splitlines():
395395
if not line:
396396
continue
397397
if not matching and re.match("SYMBOL TABLE:", line):

0 commit comments

Comments
 (0)