mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-24 13:31:29 +00:00
Merge pull request #675 from realm/al/cleanup
call cleanup on exceptions and ctr-c
This commit is contained in:
commit
df18d1f925
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user