Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

gocode.exe does not close when VS Code exits #26

Closed
syncore opened this issue Nov 19, 2015 · 9 comments
Closed

gocode.exe does not close when VS Code exits #26

syncore opened this issue Nov 19, 2015 · 9 comments

Comments

@syncore
Copy link

syncore commented Nov 19, 2015

On Windows, gocode.exe continues to run even after VS code is completely closed. I am not sure of the behavior on other platforms. Is there a way to automatically close gocode.exe when the editor itself is exited?

@lukehoban lukehoban added the bug label Nov 19, 2015
@lukehoban
Copy link
Contributor

Yes - we should be invoking gocode close when the extension is deactivated to try and stop the gocode deamon.

@egamma
Copy link
Member

egamma commented Nov 21, 2015

just a heads-up, in 0.10.1 a deactivate() function for cleaning-up isn't supported yet.

@lukehoban
Copy link
Contributor

Thanks @egamma - is there an issue already tracking this that we can link here?

I think that means we can't really fix this for now. Will keep this active waiting for the deactivate call to be added in Code.

@egamma
Copy link
Member

egamma commented Nov 23, 2015

you could listen on the 'exit' event of the extension host process.

process.on('exit', function(code) {

@lukehoban
Copy link
Contributor

@egamma Unfortunately it doesn't look like that will work - shutting down gocode requires shelling out to gocode close and I'm not seeing that run inside the 'exit' handler. The node.js docs say that you cannot do async work in this handler, which is likely the reason this isn't working?

There is no way to prevent the exiting of the event loop at this point, and once all exit listeners have finished running the process will exit. Therefore you must only perform synchronous operations in this handler.

@egamma
Copy link
Member

egamma commented Nov 24, 2015

never tried this, but could spawning another process that runs gocode close work? There is a sync function to spawn a process: childProcess.execSync.

@lukehoban
Copy link
Contributor

I tried that, and it doesn't seem to work either. I also tried just doing a fs.writeFileSync and even that's not working.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Oct 17, 2016

@lukehoban Correct me if I am wrong, but since gocode is a daemon, if it was already running (say the user was using it independent of VS Code), then VS Code wouldn't start a new process. In this case, closing it when the editor closes wouldnt be the right thing to do.

@ramya-rao-a ramya-rao-a removed their assignment Oct 17, 2016
@ramya-rao-a
Copy link
Contributor

Closing this issue as a "won't fix" because of #26 (comment)

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants