lirantal/is-website-vulnerable

Console error code of 2 during successful commands?

willsmanley opened this issue ยท 7 comments

Not sure if this is the intended behavior, but when I run the command successfully, it still outputs a console error code of "2". If I understand correctly, a successful command should output "0" for successful executions.

Is this the correct behavior?

If desired I can fill out the full bug report, but I figured a quick post would be better to address this small issue.

Otherwise thanks for the awesome package!

So, basically the command will exit with a status code of 2 if the website you're trying to run the command against has vulnerabilities.

if (audit.hasVulnerabilities(results)) {
process.exit(2)

Ok thanks for letting me know. Is there an exit status code for unsuccessful commands (such as the website DNS records could not be found)?

Yes, it is 1

console.error(`\nError: ${error.message}\n`)
console.error('Usage:\n is-website-vulnerable https://www.google.com\n\n')
process.exit(1)

Thanks Raj for picking up this one!

Should we document those Exit codes in the README, @lirantal?

@Ryuno-Ki yes, sounds like a great idea!
Can you open a PR to add?

At your command: #81