mirror of
https://github.com/vladocar/screenshoteer.git
synced 2024-12-22 13:42:19 +01:00
Call process exit when fails
This commit is contained in:
parent
7791bf3288
commit
a9e6c4a77c
1 changed files with 34 additions and 20 deletions
14
index.js
14
index.js
|
@ -29,6 +29,15 @@ console.log(urlvalue);
|
||||||
console.log(fullPage);
|
console.log(fullPage);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
|
try {
|
||||||
|
await execute();
|
||||||
|
} catch(e) {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function execute() {
|
||||||
const browser = await puppeteer.launch()
|
const browser = await puppeteer.launch()
|
||||||
const page = await browser.newPage()
|
const page = await browser.newPage()
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
|
@ -50,4 +59,9 @@ console.log(fullPage);
|
||||||
if (program.pdf) await page.pdf({ path: t + " " + program.emulate + " " + d.getTime() + '.pdf' })
|
if (program.pdf) await page.pdf({ path: t + " " + program.emulate + " " + d.getTime() + '.pdf' })
|
||||||
console.log(t)
|
console.log(t)
|
||||||
await browser.close()
|
await browser.close()
|
||||||
|
}
|
||||||
|
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue