#!/usr/bin/env node
var phantomas = require('./index'),
	child;

var url = 'http://example.com';

child = phantomas(url, {verbose: true}, function(err, res) {
	if (err) {
		console.log('err #' + err);
		process.exit(err);
	}

	console.log(res);
});

// emit --verbose messages
child.stderr.pipe(process.stderr);

child.on('results', function (res) {
	console.log(res);
});

/**
child.on('data', function (data) {
	console.log(data);
});

child.on('error', function (code) {
	console.log(code);
	process.exit(code);
});
/**/

@@ -18,24 +18,19 @@
 de%0Avar p
-hantomas
+ath
  = requi
@@ -37,252 +37,232 @@
 re('
-./index'),%0A%09child;%0A%0Avar url = 'http://example.com';%0A%0Achild = phantomas(url, %7Bverbose: true%7D, function(err, res) %7B%0A%09if (err) %7B%0A%09%09console.log('err #' + err);%0A%09%09process.exit(err);%0A%09%7D%0A%0A%09console.log(res);%0A%7D);%0A%0A// emit --verbose messages%0Achild
+path'),%0A%09spawn = require('child_process').spawn,%0A%09phantomjs = require('phantomjs');%0A%0Avar phantomas = spawn(phantomjs.path, %5Bpath.resolve(__dirname, 'phantomjs/phantomas.js')%5D.concat(process.argv.slice(2)));%0A%0Aphantomas
 .std
-err
+out
 .pip
@@ -278,195 +278,93 @@
 .std
-err);%0A%0Achild.on('results', function (res) %7B%0A%09console.log(res);%0A%7D);%0A%0A/**%0Achild.on('data', function (data) %7B%0A%09console.log(data);%0A%7D);%0A%0Achild.on('error', function (code) %7B%0A%09console.log(code);
+out);%0Aphantomas.stderr.pipe(process.stderr);%0A%0Aphantomas.on('close', function (code) %7B
 %0A%09pr
@@ -389,9 +389,4 @@
 %7D);%0A
-/**/%0A

remove changes