fix: process host early exit crash (#26642)
This commit is contained in:
parent
d08b38013d
commit
f41c862ac6
|
|
@ -28,7 +28,7 @@ export type ProcessExitData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ProcessHost extends EventEmitter {
|
export class ProcessHost extends EventEmitter {
|
||||||
private process!: child_process.ChildProcess;
|
private process: child_process.ChildProcess | undefined;
|
||||||
private _didSendStop = false;
|
private _didSendStop = false;
|
||||||
private _didFail = false;
|
private _didFail = false;
|
||||||
private didExit = false;
|
private didExit = false;
|
||||||
|
|
@ -85,7 +85,7 @@ export class ProcessHost extends EventEmitter {
|
||||||
});
|
});
|
||||||
|
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
this.process.once('exit', (code, signal) => reject(new Error(`process exited with code "${code}" and signal "${signal}" before it became ready`)));
|
this.process!.once('exit', (code, signal) => reject(new Error(`process exited with code "${code}" and signal "${signal}" before it became ready`)));
|
||||||
this.once('ready', () => resolve());
|
this.once('ready', () => resolve());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -154,6 +154,6 @@ export class ProcessHost extends EventEmitter {
|
||||||
private send(message: { method: string, params?: any }) {
|
private send(message: { method: string, params?: any }) {
|
||||||
if (debug.enabled('pw:test:protocol'))
|
if (debug.enabled('pw:test:protocol'))
|
||||||
debug('pw:test:protocol')('SEND ► ' + JSON.stringify(message));
|
debug('pw:test:protocol')('SEND ► ' + JSON.stringify(message));
|
||||||
this.process.send(message);
|
this.process?.send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue