Node.js sys pump
var spawn=require('child_process').spawn, pump=require('sys').pump; var cat=spawn('cat'); cat.stdin.write('hello '); setTimeout(function(){ cat.stdin.end('bye\n'); }, 2000);//from w w w. ja va 2 s . c o m pump(cat.stdout, process.stdout);