Browse Source

nextTick: explicitly no-op when _exiting

v0.9.1-release
isaacs 12 years ago
parent
commit
19ecc17e6b
  1. 4
      src/node.js
  2. 4
      test/simple/test-next-tick.js

4
src/node.js

@ -309,6 +309,10 @@
};
process.nextTick = function(callback) {
// on the way out, don't bother.
// it won't get fired anyway.
if (process._exiting) return;
var tock = { callback: callback };
if (process.domain) tock.domain = process.domain;
nextTickQueue.push(tock);

4
test/simple/test-next-tick.js

@ -44,7 +44,9 @@ process.nextTick(function() {
complete++;
});
process.on('exit', function() {
assert.equal(5, complete);
process.nextTick(function() {
throw new Error('this should not occur');
});
});

Loading…
Cancel
Save