Prompt before closing window if terminals have running children #6042
+35
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Linux the user is prompted with a message box that
child processes are running and if they want to quit
and thus kill them.
Implemented for:
I might be able to add Windows on this list, but MacOS users; well they're on their own. There is absolutely no way to do this in a cross platform manner. But it works on Linux. As such the pull requests should be accepted and issue updated with information that it is not implemented for the other platforms.
Additional features that could be implemented;
The changes are only made to one file; index.ts. A utility closure called
sessionHasRunningChildren
checks the Session object's pid, to look in the in-memory drive /proc/.../pid/... to see if Linux has any child info of that pid there and handles it accordingly. It's nowhere near as well designed as this on Windows; instead there we have to jump through a lot of hoops, one of which involves spawning a child process that executes PowerShell and runs some commands - or calling WinAPIs through FFI directly, which in and of itself is very unstable. Poor design, but what else is new on Windows?I commented in the issue thread here some questions, but I get that this feature isn't exactly at the top of the list.
Also, if and when the PR gets accepted could you be so kind to tag the PR as "hacktoberfest-accepted"? It would be very nice of you.
If you, @LabhanshAgrawal for instance, have some ideas on how to solve the tab thing, or where I could do what is needed, I'd gladly add that additional (though unrequested by the issue) feature, but filed under a separate issue if you would be so kind.