Skip to content

Commit 46ccdba

Browse files
committed
iasync_module.py: fix printing long traceback on ctrl+C
1 parent 17fdda2 commit 46ccdba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

slips_files/common/abstracts/iasync_module.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ def handle_loop_exception(self, loop, context):
113113
self.print(f"Unhandled loop error: {context.get('message')}")
114114

115115
def run(self):
116-
asyncio.run(self._run_pre_main_and_main())
116+
try:
117+
asyncio.run(self._run_pre_main_and_main())
118+
except (KeyboardInterrupt, asyncio.CancelledError):
119+
# Graceful shutdown: nothing more to do
120+
pass
117121

118122
async def _run_pre_main_and_main(self):
119123
"""

0 commit comments

Comments
 (0)