fix: don't swallow uncaughtException

This commit is contained in:
Andre Medeiros 2019-07-23 17:24:02 -04:00
parent 6f7a4673e0
commit 995a8311de
1 changed files with 1 additions and 4 deletions

View File

@ -209,14 +209,11 @@ Screen.bind = function(screen) {
Screen._bound = true;
process.on('uncaughtException', Screen._exceptionHandler = function(err) {
if (process.listeners('uncaughtException').length > 1) {
return;
}
Screen.instances.slice().forEach(function(screen) {
screen.destroy();
});
err = err || new Error('Uncaught Exception.');
console.error(err.stack ? err.stack + '' : err + '');
process.stderr.write((err.stack || err) + "\n");
nextTick(function() {
process.exit(1);
});