title: Extra stdio streams for node.js process
body: <p>The node.js API documents using an extra stdio (fd=4) when spawning a child process: </p>
  
  <pre><code>// Open an extra fd=4, to interact with programs present a
  // startd-style interface.
  spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
  </code></pre>
  
  <p>That stdio would be available to the parent process via <code>ChildProcess.stdio[fd]</code>.</p>
  
  <p>How can the child process access these extra stdios? Let's use a stream instead of a pipe on file descriptor 3 (fd=3).</p>
  
  <pre><code>/* parent process */
  
  // open file for read/write
  var mStream = fs.openSync('./shared-stream', 'r+');
  
  // spawn child process with stream object as fd=3
  spawn('node', ['/path/to/child.js'], {stdio: [0, 1, 2, mStream] });
  </code></pre>