From 32815ee60285c36055c78dfd0f1a4abe26db5ee0 Mon Sep 17 00:00:00 2001 From: Miles Hilton Date: Mon, 5 Aug 2024 10:54:47 -0400 Subject: [PATCH] style changes --- src/collector.ts | 9 +-------- src/utils.ts | 10 +++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/collector.ts b/src/collector.ts index 719c938..6dfc710 100644 --- a/src/collector.ts +++ b/src/collector.ts @@ -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); diff --git a/src/utils.ts b/src/utils.ts index 18a8139..13a0615 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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(); };