You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Navigate to localhost:8080 and verify that a webserver is running
In the command palette, run "Kill child process"
Navigate to localhost:8080 and verify that no webserver is running; the cleanup command works correctly.
In the command palette, run "Spawn child process", then close the experimental vscode instance
Navigate to localhost:8080 and verify that the webserver is still running
We ran into this issue at microsoft/vscode-react-native#300 where during normal usage of the extension, we start a long-running child process which we want to clean up when the extension stops.
Specifically we are trying to run child_process.spawn("react-native.cmd", ...), which ends up creating an instance of cmd /c react-native.cmd that in turn creates the desired node cli.js .... We would like to make sure that descendant process is cleaned up, but because there is an extra layer of indirection we cannot simply call child_proc.kill() since that kills the cmd process but not the node process.
To work around this, on windows we use taskkill /T to kill the cmd process and all its descendants. This works fine during normal operation, but when the extension is terminating invoking taskkill is an async exec operation and so it does not complete. I also tried using exec-sync but that didn't help either.
Any suggestions on how to improve our behaviour here instead of leaking processes?
The text was updated successfully, but these errors were encountered:
Apologies for not answering here sooner, the deactivate method can return a promise and the extension host process will self-destruct when all the deactivate promises have completed or when 4 seconds have elapsed, whichever happens first.
Steps to Reproduce:
localhost:8080
and verify that a webserver is runninglocalhost:8080
and verify that no webserver is running; the cleanup command works correctly.localhost:8080
and verify that the webserver is still runningWe ran into this issue at microsoft/vscode-react-native#300 where during normal usage of the extension, we start a long-running child process which we want to clean up when the extension stops.
Specifically we are trying to run
child_process.spawn("react-native.cmd", ...)
, which ends up creating an instance ofcmd /c react-native.cmd
that in turn creates the desirednode cli.js ...
. We would like to make sure that descendant process is cleaned up, but because there is an extra layer of indirection we cannot simply callchild_proc.kill()
since that kills thecmd
process but not thenode
process.To work around this, on windows we use
taskkill /T
to kill thecmd
process and all its descendants. This works fine during normal operation, but when the extension is terminating invokingtaskkill
is an async exec operation and so it does not complete. I also tried usingexec-sync
but that didn't help either.Any suggestions on how to improve our behaviour here instead of leaking processes?
The text was updated successfully, but these errors were encountered: