mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add timeout for Macho Parsers
This commit is contained in:
parent
b8a3b8e5d9
commit
4c92f61fd5
1 changed files with 7 additions and 0 deletions
|
|
@ -102,6 +102,10 @@ export async function extractMachoMeta ({ machoFileInstance, FileApi = null }) {
|
||||||
// Run through each parser
|
// Run through each parser
|
||||||
for ( const Parser of parsers ) {
|
for ( const Parser of parsers ) {
|
||||||
try {
|
try {
|
||||||
|
const parserTimeout = setTimeout(() => {
|
||||||
|
throw new Error( 'Timed out' )
|
||||||
|
}, 60 * 1000 )
|
||||||
|
|
||||||
// Run the parser
|
// Run the parser
|
||||||
const parserInstance = new Parser({
|
const parserInstance = new Parser({
|
||||||
machoFileInstance,
|
machoFileInstance,
|
||||||
|
|
@ -109,6 +113,9 @@ export async function extractMachoMeta ({ machoFileInstance, FileApi = null }) {
|
||||||
})
|
})
|
||||||
const meta = await parserInstance.run()
|
const meta = await parserInstance.run()
|
||||||
|
|
||||||
|
// Clear the timeout
|
||||||
|
clearTimeout( parserTimeout )
|
||||||
|
|
||||||
return meta
|
return meta
|
||||||
} catch ( err ) {
|
} catch ( err ) {
|
||||||
console.log( 'Macho parser failed', Parser )
|
console.log( 'Macho parser failed', Parser )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue