diff --git a/packages/node_modules/node-red/red.js b/packages/node_modules/node-red/red.js index aa1f9f726..95a42d9fd 100755 --- a/packages/node_modules/node-red/red.js +++ b/packages/node_modules/node-red/red.js @@ -342,17 +342,17 @@ process.on('uncaughtException',function(err) { process.exit(1); }); -function brexit() { +function exitWhenStopped() { RED.stop().then(function() { process.exit(); }); } -process.on('SIGINT', brexit); -process.on('SIGTERM', brexit); -process.on('SIGHUP', brexit); -process.on('SIGUSR2', brexit); // for nodemon restart -process.on('SIGBREAK', brexit); // for windows ctrl-break +process.on('SIGINT', exitWhenStopped); +process.on('SIGTERM', exitWhenStopped); +process.on('SIGHUP', exitWhenStopped); +process.on('SIGUSR2', exitWhenStopped); // for nodemon restart +process.on('SIGBREAK', exitWhenStopped); // for windows ctrl-break process.on('message', function(m) { // for PM2 under window with --shutdown-with-message - if (m === 'shutdown') { brexit } + if (m === 'shutdown') { exitWhenStopped } });