Proxy child exit code when exiting parent process

This fixes code-server exiting with zero on errors.
This commit is contained in:
Asher 2019-10-28 14:56:37 -05:00
parent ea36345d2c
commit 422503ef98
No known key found for this signature in database
GPG key ID: D63C1EF81242354A

View file

@ -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<void> {
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;