This is my code:
1. index.html:
var childprocess = nw.require('child_process');
var worker = childprocess.fork('worker.js', [], {silent:true});
worker.stdout.on('data', function(data) { console.log(String(data)); });
worker.stderr.on('data', function(data) { console.error(String(data)); });
worker.on('error', function(err) { console.error(err); });
worker.on('message',function(msg){console.log(msg)});
2. worker.js:
process.send("woah");
process.send('starting child process');
process.stdout.write("tuntak");
process.send('starting child process');
console.log("ha ha");
process.on('message', function (m) {
console.log('received message from parent: ');
process.send(m);
});
The output I get on console is :

All I want is the console log to appear in dev tools.
It says to use pipe,I've tried using pipe,inherit and other combination like:
1)child = child_process.fork('./cp.js', {stdio: ['pipe','pipe','pipe']});
child.stdio output is [null,null,null,null]
2)child = child_process.fork('./cp.js', {stdio: ['inherit','inherit','inherit']});
child.stdio output is [null,null,null,null]
3)child = child_process.fork('./cp.js', {
stdio: [
0, // Use parents stdin for child
'pipe', // Pipe child's stdout to parent
fs.openSync('err.out', 'w') // Direct child's stderr to a file
]
});
child.stdio output is [null,null,null,null].
Please point out if something is wrong here.