Using latest VS Code. We have a Launch task which starts a background task which in turn launches a web application which is debugged by Chrome (and therefore by VS Code). When you stop the debugger in Code, it does not stop the backround task that was launched - and there's no way to get a handle to that to somehow stop it. The only workaround seems to be to explicitly CTRL + C from the terminal that was initiated by VS Code.
Linking to https://github.com/SAFE-Stack/SAFE-template/issues/191 and https://github.com/Microsoft/vscode-chrome-debug/issues/759.
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
And this isn't a duplicate to that issue above.
Hey @isidorn, would the PR for that be accepted?
I may look into it (as I鈥檓 involved with the linked in original post project) if that鈥檚 ok
@Krzysztof-Cieslak let's first design the feature, and than see if we want something like this.
Should this be configurable or we should always kill the task? I think it should be configurable via a launch configuration attribute. For example "autoTerminatePrelaunchTask"
I am still not convinced if we need this. Leaving up to @weinand to decide
Here's the place where the debug should terminate the task https://github.com/Microsoft/vscode/blob/8a390ea608acc6c9a759c3ad7091dd6475c97acc/src/vs/workbench/parts/debug/electron-browser/debugService.ts#L510
Here's the place where a launch configuration attribute should be added with description
https://github.com/Microsoft/vscode/blob/8a390ea608acc6c9a759c3ad7091dd6475c97acc/src/vs/workbench/parts/debug/node/debugger.ts#L283
I am still not convinced if we need this. Leaving up to @weinand to decide
@isidorn what alternative could we use to accomplish this?
I am also trying to devise a way to accomplish this. My preLaunchTask runs a background command that eventually launches the process the debugger will attach to. I'd like to terminate the process tree started by the preLaunchTask when debugging stops.
Right now I have a postDebugTask that uses ${command:workbench.action.tasks.terminate} with an argument for the task to terminate, but the command doesn't seem to respect the argument and instead prompts for the task to terminate. While selecting the task "works", it is not a good user experience.
I would love to see an option that would just auto-terminate the pre-launch task so I don't have to write a boilerplate termination task (assuming it worked).
For those curious, I'm using this tasks.json (this is a Handlebars template, but you get the idea).
One workaround I've found is to instead of terminating the task, to just kill the terminal with ${command:workbench.action.terminal.kill}. Probably not ideal because if you have switched to a different terminal while debugging then it kills that one, but it does work relatively well if you left it on your background task...
hi all, pkill -f gocode
Most helpful comment
I am also trying to devise a way to accomplish this. My
preLaunchTaskruns a background command that eventually launches the process the debugger will attach to. I'd like to terminate the process tree started by thepreLaunchTaskwhen debugging stops.Right now I have a
postDebugTaskthat uses${command:workbench.action.tasks.terminate}with an argument for the task to terminate, but the command doesn't seem to respect the argument and instead prompts for the task to terminate. While selecting the task "works", it is not a good user experience.I would love to see an option that would just auto-terminate the pre-launch task so I don't have to write a boilerplate termination task (assuming it worked).
For those curious, I'm using this tasks.json (this is a Handlebars template, but you get the idea).