Skip to content

Commit 0ed43e8

Browse files
authored
feat(webkit) await the reading from pipe message (#894)
1 parent cdbfc4c commit 0ed43e8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"playwright": {
1111
"chromium_revision": "739261",
1212
"firefox_revision": "1025",
13-
"webkit_revision": "1137"
13+
"webkit_revision": "1139"
1414
},
1515
"scripts": {
1616
"ctest": "cross-env BROWSER=chromium node test/test.js",

src/server/webkit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import * as types from '../types';
2222
import { WKBrowser } from '../webkit/wkBrowser';
2323
import { execSync } from 'child_process';
2424
import { PipeTransport } from './pipeTransport';
25-
import { launchProcess } from './processLauncher';
25+
import { launchProcess, waitForLine } from './processLauncher';
2626
import * as fs from 'fs';
2727
import * as path from 'path';
2828
import * as platform from '../platform';
@@ -84,6 +84,7 @@ export class WebKit implements BrowserType {
8484
handleSIGINT = true,
8585
handleSIGTERM = true,
8686
handleSIGHUP = true,
87+
timeout = 30000
8788
} = options;
8889

8990
let temporaryUserDataDir: string | null = null;
@@ -135,6 +136,8 @@ export class WebKit implements BrowserType {
135136
},
136137
});
137138

139+
const timeoutError = new TimeoutError(`Timed out after ${timeout} ms while trying to connect to WebKit!`);
140+
await waitForLine(launchedProcess, launchedProcess.stdout, /^Web Inspector is reading from pipe #3$/, timeout, timeoutError);
138141
transport = new PipeTransport(launchedProcess.stdio[3] as NodeJS.WritableStream, launchedProcess.stdio[4] as NodeJS.ReadableStream);
139142
browserServer = new BrowserServer(launchedProcess, gracefullyClose, launchType === 'server' ? wrapTransportWithWebSocket(transport, port || 0) : null);
140143
return { browserServer, transport };

0 commit comments

Comments
 (0)