Skip to content

Commit 9cee86e

Browse files
evanlucasrvagg
authored andcommitted
node: set process._eventsCount to 0 on startup
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: #5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 127dd62 commit 9cee86e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/node.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
function startup() {
1414
var EventEmitter = NativeModule.require('events');
15+
process._eventsCount = 0;
1516

1617
Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
1718
constructor: {

test/parallel/test-process-emit.js

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ process.on('SIGPIPE', common.mustCall((data) => {
1818
process.emit('normal', 'normalData');
1919
process.emit(sym, 'symbolData');
2020
process.emit('SIGPIPE', 'signalData');
21+
22+
assert.strictEqual(isNaN(process._eventsCount), false);

0 commit comments

Comments
 (0)