Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BatMiles committed Aug 5, 2024
1 parent 8f0589b commit 32815ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions src/collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,7 @@ export const collect = async (inUrl: string, args: CollectorOptions) => {
clearDir(args.outDir, false);
}
return { status: 'success', ...output, reports };
}
// } catch (error) {
// // return error
// return {
// status: 'failed',
// page_response: 'Run failed, please try again'
// };
finally {
} finally {
// close browser and clear tmp dir
if (browser && !didBrowserDisconnect) {
await closeBrowser(browser);
Expand Down
10 changes: 5 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ const deleteFolderRecursive = path => {
// This is an annoying hack to get around an issue in Puppeteer
// where the browser.close method hangs indefinitely
// See https://github.com/Sparticuz/chromium/issues/85#issuecomment-1527692751
export const closeBrowser = async (browser) => {
console.log("closing browser");
export const closeBrowser = async browser => {
console.log('closing browser');
const pages = await browser.pages();
for (let i = 0; i < pages.length; i++) {
await pages[i].close();
await pages[i].close();
}
const childProcess = browser.process()
const childProcess = browser.process();
if (childProcess) {
childProcess.kill(9)
childProcess.kill(9);
}
await browser.close();
};
Expand Down

0 comments on commit 32815ee

Please sign in to comment.