call cleanup on exceptions and ctr-c
This commit is contained in:
parent
70e0a33f98
commit
ec2622ba96
|
@ -30,6 +30,15 @@ module.exports = function(realmConstructor) {
|
||||||
if (realmConstructor.Sync.cleanup) {
|
if (realmConstructor.Sync.cleanup) {
|
||||||
// FIXME: DOES THIS WORK ON BOTH NODE AND REACT NATIVE?
|
// FIXME: DOES THIS WORK ON BOTH NODE AND REACT NATIVE?
|
||||||
process.on('exit', realmConstructor.Sync.cleanup);
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue