Skip to content
Snippets Groups Projects
Commit 9122d7f1 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Fix a bug "Event loop closed" on xaal-shell

On Python 3.12 (new version), the watchdog_task raise a RuntimeError. To
avoid this, I need to cancel() all pending tasks
parent fc5e566c
Branches
No related tags found
No related merge requests found
......@@ -979,6 +979,17 @@ def shell():
print("$ pip install ipython\n")
exit(1)
# for a unknown reason, watchdog_task raise a RuntimeError:
# "Event loop is closed" on the shell exit. To avoid issue
# we need to stop all tasks.
async def on_stop():
for task in eng.all_tasks():
logging.debug("Stopping task %s", task.get_name())
task.cancel()
await asyncio.sleep(0.1)
eng.on_stop(on_stop)
logging.getLogger("parso").setLevel(logging.WARNING)
logging.getLogger("blib2to3").setLevel(logging.WARNING)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment