title: How to see stdout of a phantomjs child process using node.js?
body: <p>In the following node.js code, I normally have to wait for the phantomjs child process to terminate to get the stdout. I am wondering if there is any way to see the stdout while the phantomjs child process is running? </p>
  
  <pre><code>var path = require('path')
  var childProcess = require('child_process')
  var phantomjs = require('phantomjs')
  var binPath = phantomjs.path
  
  var childArgs = [
    path.join(__dirname, 'phantomjs-script.js'),
  ]
  
  childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
    // handle results 
  })
  </code></pre>