From 422503ef9856b39dfec670488d23d8183f53f2bc Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 28 Oct 2019 14:56:37 -0500 Subject: [PATCH] Proxy child exit code when exiting parent process This fixes code-server exiting with zero on errors. --- src/node/cli.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index d65397f58..2b3f77918 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -204,6 +204,7 @@ export class WrapperProcess { logger.info("Relaunching..."); this.started = undefined; if (this.process) { + this.process.removeAllListeners(); this.process.kill(); } try { @@ -223,7 +224,9 @@ export class WrapperProcess { public start(): Promise { if (!this.started) { const child = this.spawn(); - this.started = ipcMain.handshake(child); + this.started = ipcMain.handshake(child).then(() => { + child.once("exit", (code) => exit(code!)); + }); this.process = child; } return this.started;