[New-bugs-announce] [issue43523] Handling Ctrl+C when waiting on stdin on Windows via winrs

George Sovetov report at bugs.python.org
Tue Mar 16 17:48:50 EDT 2021


New submission from George Sovetov <georgesovetov at gmail.com>:

Ctrl+C alone has no effect, but Ctrl+Break works:
```
winrs -r:127.0.0.1:20465 -u:Administrator -p:qweasd123 python -c "import sys;sys.stdin.read(1)"
```
Although, if I press Ctrl+C, type zero or more symbols and then press Enter, KeyboardInterrupt is raised:
```
lalala
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Program Files\Python39\lib\encodings\cp1252.py", line 22, in decode
    def decode(self, input, final=False):
KeyboardInterrupt
^C^C
```

With the following commands, both Ctrl+C and Ctrl+Break work:
```
winrs -r:127.0.0.1:20465 -u:Administrator -p:qweasd123 python -c "import time;time.sleep(10)"
"c:\Program Files\Python39\python.exe" -c "import sys; sys.stdin.read(1)"
"c:\Program Files\Python39\python.exe" -c "import time;time.sleep(10)"
```

I faced this issue when working with WSMV (Windows remoting API) directly, but I reproduced this with winrs to make sure it's not a bug in my code. I send the Ctrl+C signal, got a no-error response, then poll the running command. It behaves as if a signal had no effect.

----------
messages: 388890
nosy: sovetov
priority: normal
severity: normal
status: open
title: Handling Ctrl+C when waiting on stdin on Windows via winrs
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43523>
_______________________________________


More information about the New-bugs-announce mailing list