hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/scripts/clang-tools/run-clang-tools.py
....@@ -60,14 +60,21 @@
6060
6161
6262 def main():
63
- args = parse_arguments()
63
+ try:
64
+ args = parse_arguments()
6465
65
- lock = multiprocessing.Lock()
66
- pool = multiprocessing.Pool(initializer=init, initargs=(lock, args))
67
- # Read JSON data into the datastore variable
68
- with open(args.path, "r") as f:
69
- datastore = json.load(f)
70
- pool.map(run_analysis, datastore)
66
+ lock = multiprocessing.Lock()
67
+ pool = multiprocessing.Pool(initializer=init, initargs=(lock, args))
68
+ # Read JSON data into the datastore variable
69
+ with open(args.path, "r") as f:
70
+ datastore = json.load(f)
71
+ pool.map(run_analysis, datastore)
72
+ except BrokenPipeError:
73
+ # Python flushes standard streams on exit; redirect remaining output
74
+ # to devnull to avoid another BrokenPipeError at shutdown
75
+ devnull = os.open(os.devnull, os.O_WRONLY)
76
+ os.dup2(devnull, sys.stdout.fileno())
77
+ sys.exit(1) # Python exits with error code 1 on EPIPE
7178
7279
7380 if __name__ == "__main__":