fix(audit): handle errors

This commit is contained in:
Guillaume Chau
2019-04-09 16:22:50 +02:00
parent dcecb941eb
commit 2b4d74b58b
@@ -20,6 +20,14 @@ exports.auditProject = async function (cwd) {
reject: false
})
if (child.stderr) {
const errLines = child.stderr.split('\n').map(l => l.trim()).filter(l => l)
const error = errLines.find(l => l.startsWith('Error:'))
if (error) {
throw new Error(error.substr('Error:'.length).trim())
}
}
const data = child.stdout
let auditAdvisories = []