casperjs
664 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').split(' ')
CASPER_PATH = os.path.abspath(os.path.join(os.path.dirname(resolve(__file__)), '..'))
CASPER_ARGS = PHANTOMJS_EXEC
CASPER_ARGS.extend([os.path.join(CASPER_PATH, 'bin', 'bootstrap.js'), '--casper-path=%s' % CASPER_PATH, '--cli'])
CASPER_ARGS.extend(sys.argv[1:])
try:
status = subprocess.call(CASPER_ARGS)
except KeyboardInterrupt:
print '\nCasperJS interrupted, exiting.'
status = 0
sys.exit(status)