microsoft / microsoft/terminal
FreeConsole() doesn't work past 5s during CTRL_CLOSE_EVENT
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
Windows Terminal version
1.17.11461.0
Windows build number
10.0.19045.3086
Other Software
c++
mingwx64
an ide of your choice
cpu arch: x64
Steps to reproduce
compile this code in c++ and run it.
go to task manager --> open terminal group processes --> program.exe --> go to details
click the x button on windows terminal.
the process of program.exe is no longer running and if you insert a while loop in the handler it closes 5 seconds later. This bug is reproducible with cmd powershell and conhost and windows terminal. I don't know which program issue or issues its on so I am reporting it here
BOOL WINAPI controlHandler(DWORD sig)
{
if(sig == CTRL_CLOSE_EVENT)
{
Beep(800, 500);
FreeConsole();
return TRUE;
}
}
int main()
{
SetConsoleCtrlHandler(&controlHandler, TRUE);
while(true);
}
Expected Behavior
the process to stay open
Actual Behavior
process closes
Related Note:
FreeConsole() api doesn't have a parameter of PID and doesn't free all child processes another bug
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository file or test. Start by reproducing the provided C++ CTRL_CLOSE_EVENT handler with Windows Terminal, cmd, PowerShell, and conhost, then determine whether the five-second termination is terminal-specific or Windows API behavior. Done requires identifying an actionable terminal-side change or documenting that the behavior is outside this repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100