fix process.exit and uncaughtException code.
This commit is contained in:
parent
84ea0890a8
commit
1f0413e262
|
@ -47,15 +47,22 @@ Bitcoin.prototype.start = function(callback) {
|
|||
process.exit = function(code) {
|
||||
exitCaught = code || 0;
|
||||
if (!self._shutdown) {
|
||||
return self._exit(exitCaught);
|
||||
return self._exit(code);
|
||||
}
|
||||
self.stop();
|
||||
};
|
||||
|
||||
process.on('uncaughtException', function(err) {
|
||||
if (process.listeners('uncaughtException').length > 1) {
|
||||
return;
|
||||
}
|
||||
errorCaught = err;
|
||||
if (!self._shutdown) {
|
||||
return self._exit(exitCaught !== none ? exitCaught : 1);
|
||||
if (err && err.stack) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
self._exit(1);
|
||||
return;
|
||||
}
|
||||
self.stop();
|
||||
});
|
||||
|
@ -91,7 +98,7 @@ Bitcoin.prototype.start = function(callback) {
|
|||
}
|
||||
|
||||
if (errorCaught !== none) {
|
||||
if (errorCaught.stack) {
|
||||
if (errorCaught && errorCaught.stack) {
|
||||
console.error(errorCaught.stack);
|
||||
}
|
||||
return self._exit(0);
|
||||
|
|
Loading…
Reference in New Issue