diff --git a/lib/widget.js b/lib/widget.js index 86c43d7..ae8386c 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -361,11 +361,13 @@ function Screen(options) { this._maxListeners = Infinity; - process.on('uncaughtException', function(err) { - reset(); - if (err) console.error(err.stack ? err.stack + '' : err + ''); - return process.exit(1); - }); + if (this.options.handleUncaughtExceptions !== false) { + process.on('uncaughtException', function(err) { + reset(); + if (err) console.error(err.stack ? err.stack + '' : err + ''); + return process.exit(1); + }); + } process.on('SIGTERM', function() { return process.exit(0);