Skip to content

Commit

Permalink
fix: negative timeout doesn't break launch (#10480)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Jun 29, 2023
1 parent 25cb642 commit 6a89a2a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/browsers/src/launch.ts
Expand Up @@ -368,7 +368,7 @@ export class Process {
this.#clearListeners();
}

waitForLineOutput(regex: RegExp, timeout?: number): Promise<string> {
waitForLineOutput(regex: RegExp, timeout = 0): Promise<string> {
if (!this.#browserProcess.stderr) {
throw new Error('`browserProcess` does not have stderr.');
}
Expand All @@ -380,7 +380,8 @@ export class Process {
rl.on('close', onClose);
this.#browserProcess.on('exit', onClose);
this.#browserProcess.on('error', onClose);
const timeoutId = timeout ? setTimeout(onTimeout, timeout) : 0;
const timeoutId =
timeout > 0 ? setTimeout(onTimeout, timeout) : undefined;

const cleanup = (): void => {
if (timeoutId) {
Expand Down

0 comments on commit 6a89a2a

Please sign in to comment.