From df1ffe34e90710eb1769900f54c5f6661a4db9d4 Mon Sep 17 00:00:00 2001 From: Alex Carney Date: Sat, 23 Nov 2024 18:43:22 +0000 Subject: [PATCH] lsp-devtools: Suppress `asyncio.CancelledError` --- lib/lsp-devtools/changes/191.fix.md | 1 + lib/lsp-devtools/lsp_devtools/agent/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 lib/lsp-devtools/changes/191.fix.md diff --git a/lib/lsp-devtools/changes/191.fix.md b/lib/lsp-devtools/changes/191.fix.md new file mode 100644 index 0000000..af307dc --- /dev/null +++ b/lib/lsp-devtools/changes/191.fix.md @@ -0,0 +1 @@ +The `lsp-devtools agent` should now suppress `asyncio.CancelledError` exceptions allowing the agent to process to terminate gracefully diff --git a/lib/lsp-devtools/lsp_devtools/agent/__init__.py b/lib/lsp-devtools/lsp_devtools/agent/__init__.py index 82c0cd7..ef82460 100644 --- a/lib/lsp-devtools/lsp_devtools/agent/__init__.py +++ b/lib/lsp-devtools/lsp_devtools/agent/__init__.py @@ -56,7 +56,10 @@ async def main(args, extra: list[str]): def run_agent(args, extra: list[str]): - asyncio.run(main(args, extra)) + try: + asyncio.run(main(args, extra)) + except asyncio.CancelledError: + pass def cli(commands: argparse._SubParsersAction):