[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210520231821.12272-2-maciej.falkowski9@gmail.com>
Date: Fri, 21 May 2021 01:18:21 +0200
From: Maciej Falkowski <maciej.falkowski9@...il.com>
To: natechancellor@...il.com, ndesaulniers@...gle.com
Cc: clang-built-linux@...glegroups.com, linux-kernel@...r.kernel.org,
maciej.falkowski9@...il.com
Subject: [PATCH 2/2] Makefile: clang-tools: Omit printing stack trace when KeyboardInterrupt is raised
When user terminates the script (also implicitly through for example
`make clang-analyzer`) by using
Ctrl+C (or sending SIGINT more generally) the KeyboardInterrupt
is raised printing stack trace of the execution as shown below:
$ ./scripts/clang-tools/run-clang-tools.py clang-tidy ./compile_commands.json
^CTraceback (most recent call last):
File "./scripts/clang-tools/run-clang-tools.py", line 74, in <module>
main()
File "./scripts/clang-tools/run-clang-tools.py", line 70, in main
pool.map(run_analysis, datastore)
File "/usr/lib64/python3.8/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib64/python3.8/multiprocessing/pool.py", line 765, in get
self.wait(timeout)
File "/usr/lib64/python3.8/multiprocessing/pool.py", line 762, in wait
self._event.wait(timeout)
File "/usr/lib64/python3.8/threading.py", line 558, in wait
Process ForkPoolWorker-6:
Process ForkPoolWorker-1:
Process ForkPoolWorker-5:
Process ForkPoolWorker-7:
Process ForkPoolWorker-2:
Process ForkPoolWorker-3:
Process ForkPoolWorker-4:
Process ForkPoolWorker-8:
signaled = self._cond.wait(timeout)
File "/usr/lib64/python3.8/threading.py", line 302, in wait
waiter.acquire()
KeyboardInterrupt
The patch handles the raise of the KeyboardInterrupt and exits when occurred
with code 130 as documented in: https://tldp.org/LDP/abs/html/exitcodes.html
Signed-off-by: Maciej Falkowski <maciej.falkowski9@...il.com>
---
scripts/clang-tools/run-clang-tools.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/clang-tools/run-clang-tools.py b/scripts/clang-tools/run-clang-tools.py
index 38fc311d2e03..eb0e0ecfce24 100755
--- a/scripts/clang-tools/run-clang-tools.py
+++ b/scripts/clang-tools/run-clang-tools.py
@@ -77,4 +77,7 @@ def main():
if __name__ == "__main__":
- main()
+ try:
+ main()
+ except KeyboardInterrupt:
+ sys.exit(130)
--
2.26.3
Powered by blists - more mailing lists