Skip to content

Commit 76699a0

Browse files
matiuszkajonathanslenders
authored andcommitted
Capture cancellation exception upon stopping the Telnet server
1 parent df8246c commit 76699a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

prompt_toolkit/contrib/telnet/server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ async def stop(self) -> None:
316316
t.cancel()
317317

318318
for t in self._application_tasks:
319-
await t
319+
try:
320+
await t
321+
except asyncio.CancelledError:
322+
logger.debug("Task %s cancelled", str(t))
320323

321324
def _accept(self) -> None:
322325
"""

0 commit comments

Comments
 (0)