1
fansekey 2014 年 7 月 23 日
var spawn = require('child_process').spawn;
var h = spawn('ls', ['-l', '.']); h.stdout.on('data', function (s) { console.log(s.toString()); }); h.stdout.on('end', function () { console.log('ls done'); }); 可以这么做;子进程的h.stdout其实是个流,你可以这么边执行边获取子进程的标准输出。 |
2
stormslowly 2014 年 7 月 24 日
h.stdout.pipe( your stream handler goes here )
|