From 0eab88786eda03dad0d7d3ae225c3fea3a6cf634 Mon Sep 17 00:00:00 2001 From: Jarmo Isotalo Date: Thu, 26 Jan 2017 02:48:12 +0200 Subject: [PATCH] Don't process.exit(null) when e.g build is `SIGKILL`ed --- bin/next | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/next b/bin/next index bce40f6fce84f..864f6313cf117 100755 --- a/bin/next +++ b/bin/next @@ -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)