From ec2622ba9674995cc7579238338b5a8848ae00d6 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Sun, 20 Nov 2016 10:34:13 -0800 Subject: [PATCH] call cleanup on exceptions and ctr-c --- lib/extensions.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/extensions.js b/lib/extensions.js index 83cb05bd..1eddacc2 100644 --- a/lib/extensions.js +++ b/lib/extensions.js @@ -30,6 +30,15 @@ module.exports = function(realmConstructor) { if (realmConstructor.Sync.cleanup) { // FIXME: DOES THIS WORK ON BOTH NODE AND REACT NATIVE? process.on('exit', realmConstructor.Sync.cleanup); + process.on('SIGINT', function () { + realmConstructor.Sync.cleanup(); + process.exit(2); + }); + process.on('uncaughtException', function(e) { + realmConstructor.Sync.cleanup(); + console.log(e.stack); + process.exit(99); + }); } }