Monday 15 August 2011

node.js - NodeJS parse process.stdout to a variable -



node.js - NodeJS parse process.stdout to a variable -

i trying read stdout , set variable in nodejs. i've tried:

process.stdout.on('data', function(data) { console.log(data.tostring()) }); console.log('hello')

i expect output hello 2 times, outputs 1 time. why callback not triggered? works when using stdin..

you trying utilize the readable stream api on a writable stream. specifically, the process.stdout stream writing stdout not reading stdout. trying isn't possible, create infinite loop if did work, , breaks definition of stdin , stdout are.

node.js stream

No comments:

Post a Comment