How to see stdout of a phantomjs child process using node.js?
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? 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 }) You can spawn PhantomJS as a child process and subscribe to its stdout and stderr