Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style changes #97

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading