github / vscode-codeql

An extension for Visual Studio Code that adds rich language support for CodeQL
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql
MIT License
421 stars 184 forks source link

Handle exit and error events for query server child processes #3610

Closed angelapwen closed 4 months ago

angelapwen commented 4 months ago

Previously, we were using the close event handler for the query server child process(es). This did not always properly handle the case where the child query server process crashed, because close is only emitted after all stdio streams of the child process are closed (see back-linked issue).

This PR handles the exit and error processes instead: exit is emitted even if child process stdio streams are still open. Note that the documentation indicates that exit may still fire after error, so this change includes some simple logic to make sure that we only restart the query server once if both fire.

Checklist