vscode-dotnet-test-explorer
vscode-dotnet-test-explorer copied to clipboard
dotnet watch process started by auto watch feature not stopped by `dotnet-test-explorer.stop` on windows
dotnet sdk: 6.0.100 nunit: 3.13.2 OS: windows 10 example repo: https://github.com/allenbenz/dotnet-test-explorer-linger-issue
The dotnet watch process isn't stopped when executing dotnet-test-explorer.stop
. The cmd shell that started the dotnet watch process is closed however.
Workaround is to kill the dotnet process with task manager.
Reproduction steps:
- Enable the auto watch feature
- Open vscode in the checked out example repo (where the .sln file is)
- Open task manager, observe respective dotnet and cmd entries
- Run
Stop running processes
- Observe dotnet entries still present:
-
dotnet watch test --verbosity:quiet --logger "trx;LogFileName=C:\Users\allen\AppData\Local\Temp\test-explorer-fvHIQG\autoWatch0.trx"
-
"C:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\6.0.100\DotnetTools\dotnet-watch\6.0.100-rtm.21527.8\tools\net6.0\any\dotnet-watch.dll" test --verbosity:quiet --logger trx;LogFileName=C:\Users\allen\AppData\Local\Temp\test-explorer-fvHIQG\autoWatch0.trx
-
Looking into this more, this is specific to windows. https://serverfault.com/questions/47389/task-scheduler-only-killing-cmd-exe-but-not-its-child-processes https://stackoverflow.com/questions/32705857/cant-kill-child-process-on-windows
I'm able to reproduce the issue by running
cmd /c "dotnet watch test --project dotnet-test-explorer.sln"
and manually terminating the cmd process.
Using taskkill /pid <cmd pid> /t /f
does kill the dotnet child processes.
Dropping
if (this.isWindows) {
child_process.exec('taskkill /pid ' + p.pid + ' /T /F')
} else {
p.kill("SIGKILL");
}
in the stop method fixes the dotnet-test-explorer.stop
command.
Not sure what vscode does on close but it has the same problem and it's not killing the child processes either, but that's a separate issue.