From 8ef121ca042455458ee14e714d6b63e0b9fca6c3 Mon Sep 17 00:00:00 2001 From: Dirk Baeumer Date: Wed, 13 Sep 2023 09:27:05 -0700 Subject: [PATCH] Fixes #1313: Capture the exit code of a server process and print it to the log. --- client/src/node/main.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/src/node/main.ts b/client/src/node/main.ts index e021ee412..e1b5eda71 100644 --- a/client/src/node/main.ts +++ b/client/src/node/main.ts @@ -502,6 +502,17 @@ export class LanguageClient extends BaseLanguageClient { } } return Promise.reject(new Error(`Unsupported server configuration ` + JSON.stringify(server, null, 4))); + }).finally(() => { + if (this._serverProcess !== undefined) { + this._serverProcess.on('exit', (code, signal) => { + if (code !== null) { + this.error(`Server process exited with code ${code}.`, undefined, false); + } + if (signal !== null) { + this.error(`Server process exited with signal ${signal}.`, undefined, false); + } + }); + } }); }