Inside my worker file I listen for a data callback. someLib
is node-serialport.
process.on('message', function(msg) {
someLib.on('data', function(data){
console.log('some data');
process.send(data);
});
});
This prints
some data
Error: channel closed
But
process.on('message', function(msg) {
process.send('foobar');
});
works fine. It is strange but sometimes the first code example works, so the channel closed error appears randomly.
From http://nodejs.org/api/child_process.html#child_process_event_error I get the info that the error is triggered when
Sending a message to the child process failed for whatever reason.
What is "whatever reason"? Any ideas?