/**
 * phantomas script executed by PhantomJS
 *
 * Don't run it directly. Use phantomas.js nodejs script instead!
 */
var system = require('system'),
	phantomas = require('../core/phantomas'),
	instance,
	options;

// compatibility with SlimerJS
if (typeof slimer !== 'undefined') {
	// @see http://docs.slimerjs.org/current/api/require.html#require-paths
	require.paths.push('../node_modules/ansicolors');
	require.paths.push('../node_modules/ansistyles');

	system.stderr = system.stdout; // FIXME: temp hack
}

// compatibility layer for NodeJS modules
process = {argv: []};

// read options from script arguments
options = system.args[1];

try {
	// run phantomas
	instance = new phantomas(JSON.parse(options));
	instance.run();
}
catch(ex) {
	console.log('phantomas v' + phantomas.version + ' failed with an error:');
	console.log(ex);

	phantom.exit(255);
}

@@ -455,61 +455,8 @@
 s');
-%0A%0A%09system.stderr = system.stdout; // FIXME: temp hack
 %0A%7D%0A%0A

use stdout for IPC, no need for a hack here