Interactive child_process.spawn

190 views Asked by At

I want to be interactive with a node child_process however below stdout or stderr is not being called. Is this because a buffer is not filled or something? Am I to use something other then pipe such as stream?

What is worse is that this result in hanging processes although I did not detached them. Something is fishy...

var cp = require('child_process');
var childProcess = cp.spawn('git', ['add', '--patch']);

childProcess.stdout.on("data", function(data) { console.log(1, data.toString()); });
childProcess.stderr.on("data", function(data) { console.log(2, data.toString()); });

childProcess.stdin.write('e');
0

There are 0 answers