Skip to content

Commit 86e5c54

Browse files
authored
[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
1 parent 763bc92 commit 86e5c54

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import time
5050
import traceback
5151
from types import ModuleType
52-
from typing import Any, Awaitable, Callable, List, Optional, Tuple, TypeVar
52+
from typing import Any, Awaitable, Callable, List, Optional, TypeVar
5353

5454

5555
yaml: Optional[ModuleType] = None
@@ -621,4 +621,7 @@ async def main() -> None:
621621

622622

623623
if __name__ == "__main__":
624-
asyncio.run(main())
624+
try:
625+
asyncio.run(main())
626+
except KeyboardInterrupt:
627+
pass

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ The improvements are...
9595
Improvements to clang-tidy
9696
--------------------------
9797

98+
- Improved :program:`run-clang-tidy.py` script. Fixed minor shutdown noise
99+
happening on certain platforms when interrupting the script.
100+
98101
New checks
99102
^^^^^^^^^^
100103

0 commit comments

Comments
 (0)