casperjs 608 Bytes
#!/usr/bin/env python

import os
import subprocess
import sys


def resolve(path):
    if os.path.islink(path):
        return resolve(os.readlink(path))
    return path

PHANTOMJS_EXEC = os.environ.get('PHANTOMJS_EXECUTABLE', 'phantomjs')
CASPER_PATH = os.path.abspath(os.path.join(os.path.dirname(resolve(__file__)), '..'))
CASPER_ARGS = [PHANTOMJS_EXEC, os.path.join(CASPER_PATH, 'bin', 'bootstrap.js'), '--casper-path=%s' % CASPER_PATH, '--cli']
CASPER_ARGS.extend(sys.argv[1:])

try:
    subprocess.call(CASPER_ARGS)
except KeyboardInterrupt:
    print '\nCasperJS interrupted, exiting.'
    sys.exit()