-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ctrl+Break does not send 0x03 in raw mode #5128
Comments
It's documented that "CTRL+BREAK is always treated as a signal". In Is this a request to change the documented behavior to match how a raw read in Linux handles Ctrl+Break? Can you provide sample code? I tested in Linux (not WSL) using Python's |
Sample C code: #include <stdio.h>
#include <termios.h>
#include <unistd.h>
int main()
{
printf("reading: ");
fflush(stdout);
struct termios old, new;
tcgetattr(STDIN_FILENO, &old);
new = old;
cfmakeraw(&new);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &new);
char c = 0;
ssize_t len = read(STDIN_FILENO, &c, sizeof(c));
tcsetattr(STDIN_FILENO, TCSAFLUSH, &old);
printf("0x%x\n", c);
return 0;
} I only have WSL2 available on this system right now; I can test on a real Linux machine later today. I tested under WSL2 with Windows Terminal and WSLtty, and interestingly the results are different: Windows Terminal gives I'll investigate in more depth later today. Clearly this is a bit more complicated than it seemed at first. 😕 |
#1119 might be related wrt the Windows Terminal vs WSLtty discrepancy. |
OK, well, I've tested on a number of different terminal emulators (mintty, WSLtty, Windows Terminal, PuTTY, GNOME Terminal, PowerShell, CMD, ...) on native Windows/Linux as well as WSL2, and there does not appear to be any kind of sane standard for how [Ctrl/Alt/Shift+]Break should actually work. Some terminals produce a value for those key combinations but they are all over the place ( So, I think it's probably safe to close this. |
Environment
Steps to reproduce
Expected behavior
Actual behavior
Notes
SetConsoleCtrlHandler
call is removed, no output is printed at all.ReadConsole
instead makes no difference (except thatERROR_OPERATION_ABORTED
is printed).0x03
.The text was updated successfully, but these errors were encountered: