title: Child process: The stdout parameter
body: <p>According to the docs, the <code>child_process.exec</code> command's callback's <code>stdout</code> parameter should be of a <code>Buffer</code> type.</p>
  
  <p><a href="http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback" rel="nofollow">http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback</a></p>
  
  <p>The problem is that it isn't:</p>
  
  <pre><code>var exec, child;
  exec = require('child_process').exec;
  
  child = exec('/bin/echo -n "hello"', function (error, stdout, stderr) {
      if (error) {
          console.log("error!");
          return;
      }
      console.log("isBuffer: " + Buffer.isBuffer(stdout));
      console.log("type: " + typeof stdout);
  });
  </code></pre>
  
  <p>This prints</p>
  
  <pre><code>isBuffer: false
  type: string
  </code></pre>
  
  <p>Why? Is this a documentation bug?</p>
  
  <p>This is a <strong>major problem</strong> because if there is binary data in <code>stdout</code>, I get the incorrect data out. Putting <code>{encoding: 'binary'}</code> into options did not help.</p>