Wednesday, 24 May 2017

Node.js : How can I use child_process to send input stream for Windows program instance that running

I would to send command for my process that launched with the following code:

var proc = require('child_process');
const child = proc.exec('myprog.exe', (err, stdout, stderr) => {
if (err) {
    console.error(err);
    return;
}
console.log(stdout);
});

I tried to write directly into input stream but I dont have response:

child.stdin.write('mycommand\n');
child.stdin.end();

When I run my program from cmd, I write at the same time my command. Could you show me please what's input stream corresponding with this ?



via yahianex

No comments:

Post a Comment