From 437aff2003a65f1280482d61f3b26b45619e6bab Mon Sep 17 00:00:00 2001 From: addshore Date: Fri, 23 Dec 2016 14:42:19 +0000 Subject: [PATCH] Allow PHAN location to be read from PATH Change-Id: I4ea64eab12f299a13559178c80fe6797d07a5f85 --- tests/phan/bin/phan | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/phan/bin/phan b/tests/phan/bin/phan index 5d42cf5914..6ce1e8419b 100755 --- a/tests/phan/bin/phan +++ b/tests/phan/bin/phan @@ -10,9 +10,16 @@ fi # Note that this isn't loaded in via composer because then composer can # only be run with php7.0 if [ ! -f "$PHAN" ]; then - echo "The environment variable PHAN must point to the 'phan' file" - echo "in a checkout of https://github.com/etsy/phan.git" - exit 1 + # If no PHAN is specified then try to get location from PATH + export PHAN="$(which phan)" + if [ ! -f "$PHAN" ]; then + echo "The environment variable PHAN must point to the 'phan' file" + echo "in a checkout of https://github.com/etsy/phan.git" + echo "Or phan must be included in your PATH" + exit 1 + fi +else + export PHAN="php7.0 $PHAN" fi if [ -z "$MW_INSTALL_PATH" ]; then @@ -57,7 +64,7 @@ export RUN="${ISSUES}/issues-${REV}" # Run the analysis, emitting output to the # issues file. -php7.0 $PHAN \ +$PHAN \ --project-root-directory "$ROOT" \ --config-file "$CONFIG_FILE" \ --output "php://stdout" \ -- 2.20.1