From b945d5c7342c57cc620e57bff38e8647be1a28f5 Mon Sep 17 00:00:00 2001 From: Dan Kaplun Date: Thu, 5 Jun 2014 12:22:38 -0500 Subject: [PATCH] Adds handleUncaughtExceptions option that allows disabling of Screen's uncaughtException handler --- lib/widget.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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);