Terminate child processes on Windows (#4723)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Windows doesn't have signals, the default Kill doesn't actually kill anything, and other forms of termination don't allow cleanup. So we spawn preview processes in a new process group and send them a CTRL_BREAK_EVENT to terminate. However, we only do this for "pwsh" (PowerShell 7+) and unknown/ posix-ish shells, because cmd.exe and Windows PowerShell ("powershell.exe") don't always exit on Ctrl-Break. pwsh also needs the -NonInteractive flag to exit on Ctrl-Break. If the process wasn't given its own group, or if sending the console control event fails, we fall back to the standard Kill (which likely won't help, but doesn't hurt to try). Fix #3134
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+44 added−7 removed
- other:+44 added−7 removed