Author: Nicolas van Kempen Date: 2024-09-09T11:15:28-04:00 New Revision: 86e5c5468ae3fcd65b23fd7b3cb0182e676829bd
URL: https://github.com/llvm/llvm-project/commit/86e5c5468ae3fcd65b23fd7b3cb0182e676829bd DIFF: https://github.com/llvm/llvm-project/commit/86e5c5468ae3fcd65b23fd7b3cb0182e676829bd.diff LOG: [clang-tidy][run-clang-tidy] Fix minor shutdown noise (#105724) On my new machine, the script outputs some shutdown noise: ``` Ctrl-C detected, goodbye. Traceback (most recent call last): File "/home/nvankempen/llvm-project/./clang-tools-extra/clang-tidy/tool/run-clang-tidy.py", line 626, in <module> asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete self.run_forever() File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever self._run_once() File "/usr/lib/python3.10/asyncio/base_events.py", line 1871, in _run_once event_list = self._selector.select(timeout) File "/usr/lib/python3.10/selectors.py", line 469, in select fd_event_list = self._selector.poll(timeout, max_ev) KeyboardInterrupt ``` This fixes it. Also remove an unused typing import. Relevant documentation: https://docs.python.org/3/library/asyncio-runner.html#handling-keyboard-interruption Added: Modified: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py clang-tools-extra/docs/ReleaseNotes.rst Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index b702eece37002b..f1b934f7139e94 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -49,7 +49,7 @@ import time import traceback from types import ModuleType -from typing import Any, Awaitable, Callable, List, Optional, Tuple, TypeVar +from typing import Any, Awaitable, Callable, List, Optional, TypeVar yaml: Optional[ModuleType] = None @@ -621,4 +621,7 @@ async def main() -> None: if __name__ == "__main__": - asyncio.run(main()) + try: + asyncio.run(main()) + except KeyboardInterrupt: + pass diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 8d028f8863cb7a..1ad8cedc902cb5 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -95,6 +95,9 @@ The improvements are... Improvements to clang-tidy -------------------------- +- Improved :program:`run-clang-tidy.py` script. Fixed minor shutdown noise + happening on certain platforms when interrupting the script. + New checks ^^^^^^^^^^ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits