Wrapper for NodeJS child_process.fork().
Adds callback parameter to send function. So you may receive direct callback from child process on your message. Usage is obvious from sample.
In parent:
var
ChildProcess = require('../childWithCallbacks').child,
child = new ChildProcess(__dirname + '/child.js');
child.send('Wait10sec',null,function(err,data){
console.log('Received '+data);
});In child.js:
var
parent = require('../childWithCallbacks').getParent();
parent.on('message',function(message,handle,cb){
console.log('Received '+message);
setTimeout(function(){
cb(null,'Done');
process.exit();
},10000);
});