I am trying to start a long running program that gives lots of output to sdtout. I was trying to use the method below to read data on intervals.
s = spawn('blah_long_running_expect.pl --device server');
setInterval( function (){
s.stdout.on('data', function (data) {
console.log("herehere");})
},1000);
}
This is part of a http server instance…there is a createserver somewhere before that. My eventual idea is to use response.write to output to screen
I’m getting the below error right now. I’m wondering if this setinterval way of reading lines is completely wrong?
(node) warning: possible EventEmitter memory leak detected. 11 listeners added.
Use emitter.setMaxListeners() to increase limit.
Trace:
at Socket.<anonymous> (events.js:126:17)
at Timer.callback (/tmp/requestHandlers.js:12:17)
s.stdout.on(‘data’, function (data) {
console.log(“herehere”);})
},1000);
The
.oncall adds an event listener. What you want to do instead is something like this.