Skip to content

Commit

Permalink
fix: browser does not open when there are token files
Browse files Browse the repository at this point in the history
  • Loading branch information
BLRocha committed Jul 19, 2023
1 parent 32a36a5 commit 77909a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/controllers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export async function initBrowser(
return await puppeteer.connect({ browserWSEndpoint: options.browserWS });
} else {
console.log('aqui');
removeStoredSingletonLock(options.puppeteerOptions);
return await puppeteer.launch(launchOptions);
}
} catch (e) {
Expand Down Expand Up @@ -434,3 +435,15 @@ function isChromeInstalled(executablePath: string): boolean {
return false;
}
}

function removeStoredSingletonLock(puppeteerOptions): boolean {
const platform = os.platform();
const { userDataDir } = puppeteerOptions;
try {
if (platform === 'win32') return false;
fs.unlinkSync(`${userDataDir}/SingletonLock`);
true;
} catch {
false;
}
}

1 comment on commit 77909a5

@jonalan7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.