From 26b65d63a849c5bed3517c4f7d3c8c8f464df664 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 8 Jan 2023 17:13:30 +0530 Subject: [PATCH] hotfix: Do not shutdown on unhandled exceptions --- lib/scaffold/start.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/scaffold/start.js b/lib/scaffold/start.js index b008be09..56a92eec 100644 --- a/lib/scaffold/start.js +++ b/lib/scaffold/start.js @@ -212,12 +212,13 @@ function exitHandler(options, _process, node, err) { if(err.stack) { log.error(err.stack); } - node.stop(function(err) { - if(err) { - log.error('Failed to stop services: ' + err); - } - _process.exit(-1); - }); + if(options.exit) + node.stop(function(err) { + if(err) { + log.error('Failed to stop services: ' + err); + } + _process.exit(-1); + }); } // Handle SIGINT (Ctrl+C) if (options.sigint) { @@ -229,7 +230,7 @@ function exitHandler(options, _process, node, err) { } function registerExitHandlers(_process, node) { - _process.on('uncaughtException', exitHandler.bind(null, {exit:true}, _process, node)); + _process.on('uncaughtException', exitHandler.bind(null, {exit:false}, _process, node)); _process.on('SIGINT', exitHandler.bind(null, {sigint:true}, _process, node)); }