Skip to content

Commit

Permalink
Don't process.exit(null) when e.g build is SIGKILLed (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamo authored and rauchg committed Jan 26, 2017
1 parent a76ec83 commit 51cbebb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/next
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ const bin = join(__dirname, 'next-' + cmd)

const startProcess = () => {
const proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] })
proc.on('close', (code) => process.exit(code))
proc.on('close', (code, signal) => {
if (code !== null) {
process.exit(code)
}
if (signal) {
if (signal === 'SIGKILL') {
process.exit(137)
}
console.log(`got signal ${signal}, exitting`)
process.exit(1)
}
process.exit(0)
})
proc.on('error', (err) => {
console.error(err)
process.exit(1)
Expand Down

0 comments on commit 51cbebb

Please sign in to comment.