Created
May 20, 2015 10:44
-
-
Save Darksecond/91b6ac328af43f521746 to your computer and use it in GitHub Desktop.
phantomjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BIN=/usr/local/bin/phantomjs.bin | |
RET=1 | |
MAX=5 | |
RUN=0 | |
until [ ${RET} -eq 0 ]; do | |
${BIN} $@ | |
RET=$? | |
RUN=$(($RUN +1)) | |
# exit immediately after max crashes | |
if [ ${RUN} -eq ${MAX} ]; then | |
echo "got ${RUN} unexpected results from phantomjs, giving up ..." | |
exit ${RET} | |
fi | |
# allowed values are 0-5 | |
# see https://github.com/CoreMedia/jangaroo-tools/blob/master/jangaroo-maven/jangaroo-maven-plugin/src/main/resources/net/jangaroo/jooc/mvnplugin/phantomjs-joounit-page-runner.js | |
if [ ${RET} -lt 5 ]; then | |
if [ ${RET} -eq 1 ]; then | |
echo "phantomjs misconfigured or crashed, retrying ..." | |
else | |
exit ${RET} | |
fi | |
else | |
echo "got unexpected return value from phantomjs: ${RET}. Retrying ..." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment