Switched to using a flag instead of using a replacement.
This commit is contained in:
parent
51355c51f1
commit
7b50f5ff3d
@ -9,6 +9,7 @@ var $ = bitcore.util.preconditions;
|
|||||||
var log = index.log;
|
var log = index.log;
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var shuttingDown = false;
|
||||||
|
|
||||||
log.debug = function() {};
|
log.debug = function() {};
|
||||||
|
|
||||||
@ -168,8 +169,10 @@ function exitHandler(options, _process, node, err) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (options.sigint) {
|
if (options.sigint) {
|
||||||
_process.on('SIGINT', function(){});
|
if (!shuttingDown) {
|
||||||
start.cleanShutdown(_process, node);
|
shuttingDown = true;
|
||||||
|
start.cleanShutdown(_process, node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -355,14 +355,10 @@ describe('#start', function() {
|
|||||||
it('should replace the listener for SIGINT after the first SIGINT is handled', function() {
|
it('should replace the listener for SIGINT after the first SIGINT is handled', function() {
|
||||||
var options = { sigint: true };
|
var options = { sigint: true };
|
||||||
var node = {};
|
var node = {};
|
||||||
var replacementFunc = sinon.stub();
|
exitHandler(options, process, node);
|
||||||
replacementFunc.withArgs('SIGINT', function(){});
|
cleanShutdown.callCount.should.equal(1);
|
||||||
var testProcess = {
|
exitHandler(options, process, node);
|
||||||
on: replacementFunc
|
|
||||||
}
|
|
||||||
exitHandler(options, testProcess, node);
|
|
||||||
cleanShutdown.callCount.should.equal(1);
|
cleanShutdown.callCount.should.equal(1);
|
||||||
replacementFunc.callCount.should.equal(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should log all errors and stops the services nonetheless', function() {
|
it('should log all errors and stops the services nonetheless', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user