prompt-toolkit / prompt-toolkit/python-prompt-toolkit
examples/ssh /asyncssh-server.py a CTRL-C during the progress kills also the Server
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Starting to Discover async, AsyncSSH and as well that very nice prompt_toolkit
Demo (examples/ssh /asyncssh-server.py) seems perfect as "StartPoint" to discover.
Demo is running fine.
But when you Press "CTRL-C" During the progress bar demo it will also kill the Server.
(as well on the client Side)
latest Trackack:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/gierig/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/myBBS/test.py", line 117, in main
await asyncio.Future()
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 123, in run
raise KeyboardInterrupt()
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/gierig/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/myBBS/lib/python3.13/site-packages/prompt_toolkit/contrib/ssh/server.py", line 103, in _interact
await self.interact(self)
File "/Users/gierig/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/myBBS/test.py", line 77, in interact
await asyncio.sleep(0.1)
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/tasks.py", line 718, in sleep
return await future
^^^^^^^^^^^^
asyncio.exceptions.CancelledError
INFO:asyncssh:[conn=0, chan=0] Closing channel
INFO:asyncssh:[conn=0, chan=0] Received channel close
DEBUG:asyncssh:[conn=0] Received disconnect: disconnected by user (11)
INFO:asyncssh:[conn=0, chan=0] Channel closed
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/gierig/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/myBBS/test.py", line 117, in main
await asyncio.Future()
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/gierig/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/myBBS/test.py", line 121, in <module>
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 123, in run
raise KeyboardInterrupt()
KeyboardInterrupt
Wonder that a KeyboardInterrupt is rise up till the Server Process.. t should max kill the Ssh Session and not the Server ?
Version seem latest
pip list
Package Version
----------------- -------
asyncssh 2.21.0
cffi 1.17.1
cryptography 44.0.3
pip 25.1.1
prompt_toolkit 3.0.51
pycparser 2.22
Pygments 2.19.1
typing_extensions 4.13.2
wcwidth 0.2.13
Not sure where to start to fix that...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running examples/ssh/asyncssh-server.py and pressing CTRL-C during the progress bar, then inspect how the example handles cancellation and server shutdown. The traceback shows cancellation in the interaction coroutine and asyncio.run; done means interrupting the SSH session no longer terminates the server process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100