Call process exit when fails

This commit is contained in:
Andrea D 2018-12-05 17:00:18 +01:00
parent 7791bf3288
commit a9e6c4a77c

View file

@ -29,6 +29,15 @@ console.log(urlvalue);
console.log(fullPage);
(async () => {
try {
await execute();
} catch(e) {
console.error(e);
process.exit(1);
}
async function execute() {
const browser = await puppeteer.launch()
const page = await browser.newPage()
const d = new Date()
@ -50,4 +59,9 @@ console.log(fullPage);
if (program.pdf) await page.pdf({ path: t + " " + program.emulate + " " + d.getTime() + '.pdf' })
console.log(t)
await browser.close()
}
})()