mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: negative timeout doesn't break launch (#10480)
This commit is contained in:
parent
25cb642623
commit
6a89a2aadc
@ -368,7 +368,7 @@ export class Process {
|
|||||||
this.#clearListeners();
|
this.#clearListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForLineOutput(regex: RegExp, timeout?: number): Promise<string> {
|
waitForLineOutput(regex: RegExp, timeout = 0): Promise<string> {
|
||||||
if (!this.#browserProcess.stderr) {
|
if (!this.#browserProcess.stderr) {
|
||||||
throw new Error('`browserProcess` does not have stderr.');
|
throw new Error('`browserProcess` does not have stderr.');
|
||||||
}
|
}
|
||||||
@ -380,7 +380,8 @@ export class Process {
|
|||||||
rl.on('close', onClose);
|
rl.on('close', onClose);
|
||||||
this.#browserProcess.on('exit', onClose);
|
this.#browserProcess.on('exit', onClose);
|
||||||
this.#browserProcess.on('error', onClose);
|
this.#browserProcess.on('error', onClose);
|
||||||
const timeoutId = timeout ? setTimeout(onTimeout, timeout) : 0;
|
const timeoutId =
|
||||||
|
timeout > 0 ? setTimeout(onTimeout, timeout) : undefined;
|
||||||
|
|
||||||
const cleanup = (): void => {
|
const cleanup = (): void => {
|
||||||
if (timeoutId) {
|
if (timeoutId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user