From 97a99edbf35b3d46680d51156ef2dfcb655cd5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= Date: Fri, 15 Apr 2016 00:21:53 +0200 Subject: [PATCH] [entropy.tools] correct read_elf_broken_symbols ldd (now?) prints this to stdout; read from both streams. --- lib/entropy/tools.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/entropy/tools.py b/lib/entropy/tools.py index b25075ab6..6b44d24f4 100644 --- a/lib/entropy/tools.py +++ b/lib/entropy/tools.py @@ -2872,26 +2872,24 @@ def read_elf_broken_symbols(elf_file): proc = None args = ("/usr/bin/ldd", "-r", elf_file) output = None - stdout = None try: - stdout = open(os.devnull, "wb") - proc = subprocess.Popen( - args, stdout = stdout, - stderr = subprocess.PIPE) + args, + stdout = subprocess.PIPE, + stderr = subprocess.STDOUT) output = const_convert_to_unicode("") while True: - err = proc.stderr.read() - if not err: + out = proc.stdout.read() + if not out: break if const_is_python3(): - err = const_convert_to_unicode(err) - output += err + out = const_convert_to_unicode(out) + output += out exit_st = proc.wait() if exit_st != 0: @@ -2904,9 +2902,7 @@ def read_elf_broken_symbols(elf_file): finally: if proc is not None: - proc.stderr.close() - if stdout is not None: - stdout.close() + proc.stdout.close() outcome = set() if output is not None: