-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Terminal tab terminates along with the initial process even if there are other active tasks in that console #10501
Comments
So, this was an intentional design choice that I'm willing to revisit. In the majority of cases, we haven't seen too much trouble from tracking only the root process ... but I do understand that there's a reason folks want to exchange who is the session leader in a given console session. I suspect that the most correct way to handle this while still keeping exit code reporting (and therefore the "graceful" close-on-exit behavior of closing the tab when the root process exits with code 0) would be to either expose process state through ConPTY's signal channel or have WT track the process tree spawned by the root process¹. ¹ we may need to do this anyway--it would be nice to present a "do you want to close this tab?" confirmation dialog that tells you what's running... |
Not the whole tree though: children could be spawned with The list that GetConsoleProcessList returns is probably reliable. |
Hey! On the Godot Game Engine, we're currently getting a lot of user reports of Godot not working on Windows 11 due to the Windows Terminal. This is likely the root cause. Godot launches a "project manager" process, where you can browser and select your game projects, and once you select one, it exits and starts the actual editor for that project in a new process, reusing the same console. In Windows 11 with Windows Terminal as default console, the Windows Terminal just exits if you select a project to open in the project manager. We've patched it in the current version by using If you want to have a look, this is our issue tracking this: godotengine/godot#54076 Note that the issue is closed as we used |
ISTM that only the console host process, "OpenConsole.exe", would need to be tracked for the lifetime of a tab. It's responsible for managing the console session and will exit when there are no more attached processes. For tracking in general (e.g. the session exit status), the pseudoconsole signal channel can report the pid of processes when they attach and detach from the session (e.g. Though I do think there's a need to be able to kill a console session via the root process. As mentioned on another issue, pseudoconsole sessions could be improved to support a graceful exit via |
Yanking triage and sticking it on the backlog for this reason. We're tracking that in #6549, so whenever we get to that, we should be able to enable this as well. |
I ran into this issue as well where a process updated itself by spawning a new process and exiting the parent. This works outside of Terminal and works on other operating systems. It's rather unexpected that this behaviour changed in terminal. |
Windows Terminal version (or Windows build number)
1.9.1445.0
Other Software
No response
Steps to reproduce
+ Add a new profile
,+ New empty profile
, and setCommand line
to the compiled exe.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.
The text was updated successfully, but these errors were encountered: