mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(driver): make sure IpcTransport messages arrive in different tasks (#15978)
This commit is contained in:
parent
f067d1ddd6
commit
09461f8a76
@ -106,17 +106,18 @@ export class PipeTransport {
|
||||
|
||||
export class IpcTransport {
|
||||
private _process: NodeJS.Process | ChildProcess;
|
||||
private _waitForNextTask = makeWaitForNextTask();
|
||||
onmessage?: (message: string) => void;
|
||||
onclose?: () => void;
|
||||
|
||||
constructor(process: NodeJS.Process | ChildProcess) {
|
||||
this._process = process;
|
||||
this._process.on('message', message => {
|
||||
this._process.on('message', message => this._waitForNextTask(() => {
|
||||
if (message === '<eof>')
|
||||
this.onclose?.();
|
||||
else
|
||||
this.onmessage?.(message);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
send(message: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user