I have the below code:
var schild = spawn(\'script.sh\', [\"process1\", \"process2\"]);
schild.stderr.on(\'data\', function (data) {
I believe the problem is that you're not removing the listeners when you don't need them anymore. You need to use 'schild.removeListener('exit', function)' or 'schild.removeAllListeners('exit')' when you're done with them.
See: http://nodejs.org/api/events.html#events_emitter_removelistener_event_listener
Of course there are scenarios where you need to have more than 10 listeners in which case you should use 'schild.setMaxListeners(0)' (0 means unlimited)
See: http://nodejs.org/api/events.html#events_emitter_setmaxlisteners_n
Hope it helps!