From a735bcd667ff0de802a93699e14a404d15730aeb Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 12 Jun 2024 14:31:57 -0500 Subject: [PATCH] Fixed hanging scripts trying to parse stderr code.py, specifically, was getting messed up by inconsequential GCC objdump errors on Clang -g3 generated binaries. Now stderr from child processes is just redirected to /dev/null when -v/--verbose is not provided. If we actually depended on redirecting stderr->stdout these scripts would have been broken when -v/--verbose was provided anyways. Not really sure what the original code was trying to do... --- scripts/bench.py | 8 ++++---- scripts/code.py | 6 +++--- scripts/cov.py | 2 +- scripts/data.py | 6 +++--- scripts/perf.py | 6 +++--- scripts/perfbd.py | 4 ++-- scripts/structs.py | 4 ++-- scripts/test.py | 8 ++++---- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/bench.py b/scripts/bench.py index b7423471..a7ff6259 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -653,7 +653,7 @@ def find_perms(runner, bench_ids=[], **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -685,7 +685,7 @@ def find_perms(runner, bench_ids=[], **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -732,7 +732,7 @@ def find_path(runner, id, **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -763,7 +763,7 @@ def find_defines(runner, id, **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/code.py b/scripts/code.py index 1bcdcf58..710eeb63 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -166,7 +166,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -197,7 +197,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -242,7 +242,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/cov.py b/scripts/cov.py index bc240af3..212f0889 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -227,7 +227,7 @@ def collect(gcda_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/data.py b/scripts/data.py index 8ac1f16e..7cd488e4 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -166,7 +166,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -197,7 +197,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -242,7 +242,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/perf.py b/scripts/perf.py index d234510b..c0a6ffb1 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -268,7 +268,7 @@ def collect_syms_and_lines(obj_path, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -317,7 +317,7 @@ def collect_syms_and_lines(obj_path, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -415,7 +415,7 @@ def collect_decompressed(path, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/perfbd.py b/scripts/perfbd.py index cae41f39..b852a892 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -174,7 +174,7 @@ def collect_syms_and_lines(obj_path, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -223,7 +223,7 @@ def collect_syms_and_lines(obj_path, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/structs.py b/scripts/structs.py index 10611a28..6f79a547 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -154,7 +154,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -200,7 +200,7 @@ def collect(obj_paths, *, print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) diff --git a/scripts/test.py b/scripts/test.py index 90035415..8596a6d1 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -670,7 +670,7 @@ def find_perms(runner, test_ids=[], **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -702,7 +702,7 @@ def find_perms(runner, test_ids=[], **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -749,7 +749,7 @@ def find_path(runner, id, **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False) @@ -780,7 +780,7 @@ def find_defines(runner, id, **args): print(' '.join(shlex.quote(c) for c in cmd)) proc = sp.Popen(cmd, stdout=sp.PIPE, - stderr=sp.PIPE if not args.get('verbose') else None, + stderr=None if args.get('verbose') else sp.DEVNULL, universal_newlines=True, errors='replace', close_fds=False)