microsoft / microsoft/terminal
Terminal tab terminates along with the initial process even if there are other active tasks in that console
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version (or Windows build number)
1.9.1445.0
### Other Software
_No response_
### Steps to reproduce
1. Compile the following simple program:
```C++
#include
int main()
{
STARTUPINFOW si{ sizeof(si) };
PROCESS_INFORMATION pi{};
if (!CreateProcessW(L"c:\\windows\\system32\\cmd.exe", {}, {}, {}, false, 0, {}, {}, &si, &pi))
return 1;
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return 0;
}
```
2. Go to the Terminal settings, `+ Add a new profile`, `+ New empty profile`, and set `Command line` to the compiled exe.
3. Try to open that profile.
### Expected Behavior
The tab should remain active after the initial process exits since there are other active tasks still attached to that particular console.
### Actual Behavior
It closes immediately.
## Additional details
The problem was initially observed in a more complex scenario, where an app performs a self-update by launching the updater helper process in the same console and exiting. The helper then does its magic, restarts the original program and exits, providing a smooth user experience.
Needless to say that it works and always worked in conhost.
Contributor guide
Research direction
Start by reproducing the behavior with the provided C++ program and the custom Windows Terminal profile, then compare it with conhost as described in the issue. The work is done when the tab remains active while the child process attached to the console continues running.
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
- Mostly clear
- Newbie friendliness
- 35/100