Crashes if NMAP is not installed
herrberk opened this issue · 4 comments
Hi John,
I've been using this module in my node application for a while and in overall it's pretty great! However there is one issue I'd like to mention here. It causes a crash when nmap is not installed locally. Here is the error message:
/home/.../node-nmap/index.js:66
this.child.kill();
^
TypeError: Cannot read property 'kill' of undefined
at process.NmapScan.killChild (/home/.../node-nmap/index.js:66:23)
at emitOne (events.js:96:13)
at process.emit (events.js:188:7)
at process._fatalException (bootstrap_node.js:296:26)
Is there a way of detecting if nmap is installed and returning an error message instead?
Hi,
Apologies for the late response. I can absolutely add something in to check for NMAP. The code for this was written quite a while ago, and is a bit messy relative to my current work, but if you'd want to make a pull request I'd happily test and accept. Otherwise I'll get around to it sometime this week.
Hi @herrberk,
I've added some error checking that will gracefully fail (via emitting an error event scan.on('error',(err)=>{})
) This will return an error notifying you that nmap could not be found.
Let me know how this works out for you.
Added fix
Hi John,
Sorry for the delayed response, it works great now. Thank you for the fix, I appreciate!