title: node.js -- execute command synchronously and get result
body: <p>I'm trying to execute a child_process synchronously in node.js (Yes, I know this is bad, I have a good reason) and retrieve any output on stdout, but I can't quite figure out how...</p>
  
  <p>I found this SO post: <a href="https://stackoverflow.com/questions/4443597/node-js-execute-system-command-synchronously">node.js execute system command synchronously</a> that describes how to use a library (node-ffi) to execute the command, and this works great, but the only thing I'm able to get is the process exit code.  Any data the command executes is sent directly to stdout -- how do I capture this?</p>
  
  <pre><code>&gt; run('whoami')
  username
  0
  </code></pre>
  
  <p>in otherwords, <code>username</code> is echo'd to stdout, the result of <code>run</code> is <code>0</code>.</p>
  
  <p>I'd <strong><em>much</em></strong> rather figure out how to read stdout</p>