Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/prompt_toolkit/contrib/ssh/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ async def _interact(self) -> None:
with create_pipe_input() as self._input:
with create_app_session(input=self._input, output=self._output) as session:
self.app_session = session

try:
await self.interact(self)
except BaseException:

except asyncio.CancelledError:
# Expected during disconnect/shutdown.
pass
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you propagate rather than suppress using raise instead of pass?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I updated the handler so asyncio.CancelledError is now re-raised instead of being swallowed. Regular application exceptions are still handled separately, so cancellation behavior stays intact without mixing it into normal error handling


except Exception:
traceback.print_exc()

finally:
# Close the connection.
self._chan.close()
Expand Down
Loading