Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function spawn() {
const command = spawnSync.apply(null, arguments)
const hasError = command.status !== 0
const stderr = command.stderr && command.stderr.toString().trim()
const sigint = command.signal === 'SIGINT'
if (hasError || stderr || sigint) {
let errorMessage = command.error && command.error.message
if (stderr) {
errorMessage = stderr
} else if (sigint) {
errorMessage = 'Unexpected exited with signal SIGINT'
}
if (errorMessage) {
console.log(errorMessage)
}
failed(command.status)
} else {
return command