windows ctrl + c signals not firing windows ctrl + c signals not firing powershell powershell

windows ctrl + c signals not firing


It appears that firing GenerateConsoleCtrlEvent after a user invoked ctrl+c is what puts the shell into this strange state. When the user enters ctrl+c there is really no need for my application to call GenerateConsoleCtrlEvent because the GenerateConsoleCtrlEvent broadcasts to every process in the console. Unfortunately having my app forego GenerateConsoleCtrlEvent when it intercepts ctrl+c is easier said than done but not impossible.

Its unsettling that I have found no documentation or information stating that firing GenerateConsoleCtrlEvent after a typed ctrl+c has this odd effect but perhaps this post will help someone else.

If anyone has insights into more detail on why this state gets triggered or tips on other ways to avoid it and making the shell more resilient to GenerateConsoleCtrlEvent, please post another answer here.