isaacs / cluster-master

Take advantage of node built-in cluster module behavior
ISC License
276 stars 44 forks source link

end event listener registration error #29

Open emarteca opened 4 years ago

emarteca commented 4 years ago

Hi all, I've been working on a tool to identify instances of events registered to the wrong object in uses of some JavaScript event-driven APIs, as part of a research project. The tool flagged line 213 in cluster-master.js in the root of this repository, on the registration of the “end” event.

The reason I believe this is indicative of an error is as follows (from looking at the nodejs repl API documentation). This listener for “end” is registered on variable r, which is an object of type repl.REPLServer, initialized on line 138 by a call to repl.start(). However, “end” is not an event emitted on repl.REPLServer.

My guess is that maybe instead you should be listening for “exit” (an event on repl.REPLServer), or “close” (an event on readline.Interface, which repl.REPLServer extends).

Thanks!