Ctrl+C kills the process abruptly #18039
Labels
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Needs-Author-Feedback
The original author of the issue/PR needs to come back and respond to something
Needs-Repro
We can't figure out how to make this happen. Please help find a simplified repro.
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
Windows Terminal version
No response
Windows build number
No response
Other Software
No response
Steps to reproduce
Hello,
In a program called scrcpy that I develop, I listen to Ctrl+C on Windows using
SetConsoleCtrlHandler(windows_ctrl_handler, TRUE);
:https://github.com/Genymobile/scrcpy/blob/665ccb32f5306ebd866dc0d99f4d08ed2aeb91c3/app/src/scrcpy.c#L148-L149
It works correctly in the default (old) Windows console (typically started by
cmd.exe
), Ctrl+C is catched and the program can terminate gracefully (finishing writing a video footer for example).However, from Windows Terminal, it has been reported that Ctrl+C terminates the process abruptly (which in that case cause the recorded mp4 file to be corrupted, but any other cleanup actions cannot be executed): Genymobile/scrcpy#5122 (comment)
Is there a reason for this behavior?
Thank you for your help.
Expected Behavior
The Ctrl handler should be executed on Ctrl+C.
Actual Behavior
The process is killed abruptly on Ctrl+C.
The text was updated successfully, but these errors were encountered: