-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Cannot set SetConsoleCtrlHandler #10647
Comments
Very high chance this is resolved with #10415 |
@blacklightpy Would you mind testing on Windows 22000.65 or higher with Windows Terminal Preview 1.10? |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
@DHowett Sorry for the delay, I was sick for a while. I noticed that I can hear a beep sound when I'm closing the window, meaning CTRL_CLOSE_EVENT is triggered. The beep sound wasn't working the last time, but it wasn't working in conhost too then. Now it's working on both. CTRL_CLOSE_EVENT too is working differently from what's expected. In conhost, the program exists only after the beep is performed. In Terminal however, the tab is close immediately and the beep is heard afterwards. So if there are any print statements in the control handler, they won't be seen. I tried setting 2 beeps and a print statement between them, and both beeps were still executed. |
I'll look into this when I get a chance. |
Okay. So far... CTRL_BREAK_EVENT is coming in as a break if started within the Terminal, but as a CTRL_C if started from DefApp. So that one is DefApp related. CTRL_CLOSE_EVENT seems to behave the same for both and makes the noise after the tab goes away. That slightly tracks with how tab handing works and we'd likely have to introduce a delay/ordering of sorts there to stop that one and is likely NOT DefApp related. CTRL_C_EVENT just works in both. Now trying to figure out how to do CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT as I think those are weird/difficult. |
There's another issue with CTRL_CLOSE_EVENT related to CloseTest.exe (from our tools folder). It is not propagating to all the children... |
Windows Terminal version (or Windows build number)
1.9.1523.0
Other Software
I wrote a console application in C++ and wanted to handle CTRL_CLOSE_EVENT.
I set my default terminal as Windows Terminal, so the app launched in it by default.
I wasn't sure why the method wasn't working and after a while I decided to try out running the program in conhost and it worked.
Here's the code:
I guessed this could be because Windows Terminal uses Win32 windows, but this could cause compatibility issues with existing console apps.
Steps to reproduce
Run the program and try to trigger a CTRL_C_EVENT
Expected Behavior
CtrlHandler handles the event
Actual Behavior
CtrlHandler is not invoked
The text was updated successfully, but these errors were encountered: