title: nodejs fifo works when piping to stdout but not when piping to file
body: <p>I'm playing around with node and fifos and am getting some bizarre behavior I can't explain. Basically, I'm creating a fifo using spawn, creating a writestream to that fifo, piping data to the writestream, and spawning a cat command that reads from the fifo. It works if I then pipe the results of the cat command to stdout, but doesn't work if I pipe them to another file. See the code below</p>
  
  <p>Note: this behavior only exhibits when you are writing enough data to hit the write buffer</p>
  
  <pre><code>var fs = require('fs'),
  stream = require('stream');
  
  // create read stream
  var rs = fs.createReadStream('testinput')
  
  var spawn = require('child_process').spawn;
  
  // create fifo
  var fifo = spawn('mkfifo', ['testfifo']);
  
  fifo.on('exit', function() { // when fifo is created, proceed
  
      // create outfile and attach fifostream
      var ws = fs.createWriteStream('testoutput')
      var fifows = fs.createWriteStream('testfifo');
  
      // pipe to fifo
      rs.pipe(fifows);
  
      // spawn process to read fifo
      var prog = spawn('cat', ['testfifo']);
  
      // send results somewhere
      prog.stdout.pipe(process.stdout); // this works
      // prog.stdout.pipe(ws); // this doesn't
  })
  </code></pre>
  
  <p>I should probably say why I'm trying to do this. I want to have a stream, which is coming in from a websocket be used as the argument of a spawned command that is expecting a file. So in the example above a stream coming in can be fed to cat and behave as if cat was just reading a file.</p>