process: fix process.nextTick() error case regression
Patch and test by Koichi Kobayashi.
This commit is contained in:
parent
f5a01d1764
commit
362b5a6c40
@ -192,6 +192,9 @@
|
||||
for (var i = 0; i < l; i++) q[i]();
|
||||
}
|
||||
catch (e) {
|
||||
if (i + 1 < l) {
|
||||
nextTickQueue = q.slice(i + 1).concat(nextTickQueue);
|
||||
}
|
||||
if (nextTickQueue.length) {
|
||||
process._needTickCallback();
|
||||
}
|
||||
|
23
test/simple/test-process-next-tick.js
Normal file
23
test/simple/test-process-next-tick.js
Normal file
@ -0,0 +1,23 @@
|
||||
var assert = require('assert');
|
||||
var N = 2;
|
||||
var tickCount = 0;
|
||||
var exceptionCount = 0;
|
||||
|
||||
function cb() {
|
||||
++tickCount;
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
for (var i = 0; i < N; ++i) {
|
||||
process.nextTick(cb);
|
||||
}
|
||||
|
||||
process.on('uncaughtException', function() {
|
||||
++exceptionCount;
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
process.removeAllListeners('uncaughtException');
|
||||
assert.equal(tickCount, N);
|
||||
assert.equal(exceptionCount, N);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user