1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Don't process.exit(null) when e.g build is SIGKILLed (#887)

This commit is contained in:
Jarmo Isotalo 2017-01-26 03:10:48 +02:00 committed by Guillermo Rauch
parent a76ec83b64
commit 51cbebb240

View file

@ -46,7 +46,19 @@ const bin = join(__dirname, 'next-' + cmd)
const startProcess = () => { const startProcess = () => {
const proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }) 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) => { proc.on('error', (err) => {
console.error(err) console.error(err)
process.exit(1) process.exit(1)