old_contents: var page = require('webpage').create();
  var _ = require('underscore');
  var fs = require('fs');
  
  function stdout(str) {
    fs.write('/dev/stdout', str, 'w')
  }
  
  function stderr(str) {
    fs.write('/dev/stderr', str, 'w')
  }
  
  page.onAlert = stdout;
  page.onConsoleMessage = stdout;
  page.onError = stderr;
  
  page.onLoadFinished = function() {
    phantom.exit();
  };
  
  page.open(phantom.args[0]);
  
new_contents: var page = require('webpage').create();
  var _ = require('underscore');
  var system = require('system');
  
  page.onAlert = system.stdout.write;
  page.onConsoleMessage = system.stdout.write;
  page.onError = system.stderr.write;
  
  page.onLoadFinished = function() {
    phantom.exit(0);
  };
  
  page.open(phantom.args[0]);
  
subject: Use `system` module for phantom runner script stdout/stderr