Skip to content

Commit 422503e

Browse files
committed
Proxy child exit code when exiting parent process
This fixes code-server exiting with zero on errors.
1 parent ea36345 commit 422503e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node/cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export class WrapperProcess {
204204
logger.info("Relaunching...");
205205
this.started = undefined;
206206
if (this.process) {
207+
this.process.removeAllListeners();
207208
this.process.kill();
208209
}
209210
try {
@@ -223,7 +224,9 @@ export class WrapperProcess {
223224
public start(): Promise<void> {
224225
if (!this.started) {
225226
const child = this.spawn();
226-
this.started = ipcMain.handshake(child);
227+
this.started = ipcMain.handshake(child).then(() => {
228+
child.once("exit", (code) => exit(code!));
229+
});
227230
this.process = child;
228231
}
229232
return this.started;

0 commit comments

Comments
 (0)