Fix process handling in NPM driver

main
Elbert Alias 4 years ago
parent 19b81e504a
commit 00aa7a90d7

@ -615,11 +615,16 @@ class Site {
await page.setUserAgent(this.options.userAgent) await page.setUserAgent(this.options.userAgent)
try { try {
await this.promiseTimeout( try {
page.goto(url.href), await this.promiseTimeout(page.goto(url.href))
undefined, } catch (error) {
'Timeout (navigation)' if (
) error.constructor.name !== 'TimeoutError' &&
error.code !== 'PROMISE_TIMEOUT_ERROR'
) {
throw error
}
}
if (!this.options.noScripts) { if (!this.options.noScripts) {
await sleep(1000) await sleep(1000)
@ -779,11 +784,7 @@ class Site {
this.analyzedUrls[url.href] && this.analyzedUrls[url.href] &&
!this.analyzedUrls[url.href].status !this.analyzedUrls[url.href].status
) { ) {
await page.close() throw new Error('No response from server')
this.log(`Page closed (${url})`)
throw new Error(`No response from server`)
} }
this.cache[url.href] = { this.cache[url.href] = {
@ -843,10 +844,18 @@ class Site {
await page.close() await page.close()
this.log('Page closed') this.log(`Page closed (${url})`)
return reducedLinks return reducedLinks
} catch (error) { } catch (error) {
try {
await page.close()
this.log(`Page closed (${url})`)
} catch (error) {
this.log(error)
}
let hostname = url let hostname = url
try { try {
@ -1130,8 +1139,6 @@ class Site {
if (page) { if (page) {
try { try {
await page.close() await page.close()
this.log('Page closed')
} catch (error) { } catch (error) {
// Continue // Continue
} }

@ -13,7 +13,7 @@
"software" "software"
], ],
"homepage": "https://www.wappalyzer.com/", "homepage": "https://www.wappalyzer.com/",
"version": "6.8.6", "version": "6.8.9",
"author": "Wappalyzer", "author": "Wappalyzer",
"license": "MIT", "license": "MIT",
"repository": { "repository": {

@ -4,7 +4,7 @@
"author": "Wappalyzer", "author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com/", "homepage_url": "https://www.wappalyzer.com/",
"description": "Identify web technologies", "description": "Identify web technologies",
"version": "6.8.6", "version": "6.8.9",
"default_locale": "en", "default_locale": "en",
"manifest_version": 2, "manifest_version": 2,
"icons": { "icons": {

@ -13,7 +13,7 @@
"software" "software"
], ],
"homepage": "https://www.wappalyzer.com/", "homepage": "https://www.wappalyzer.com/",
"version": "6.8.6", "version": "6.8.9",
"author": "Wappalyzer", "author": "Wappalyzer",
"license": "MIT", "license": "MIT",
"repository": { "repository": {