| ps -p ${1:-$$} -o ppid= -o pid= -o comm= |
| while [ ${BUCK_PID[0]} -ne 0 ]; do |
| BUCK_PID=($(ppid $BUCK_PID)) |
| if [ "${BUCK_PID[2]}" == "buck" ]; then |
| if [ "${BUCK_PID[2]}" == "buckd" ] || |
| [[ "${BUCK_PID[2]}" == *"python"* ]]; then |
| # use PID of buckd or python |
| cat $PORT_FILE 2>/dev/null || echo 0 |
| function check_socket() { |
| nc localhost $(port) < /dev/null 2>/dev/null |
| # check to see if checkstyle daemon is running; if not, start it |
| # Starting checkstyle server... |
| #FIXME change to /dev/null if/when we are confident |
| nohup java -jar $CHECKSTYLE $PORT_FILE $(buck_pid) $3 $4 >>/tmp/checkstyle.daemon 2>&1 & |
| # Wait for checkstyle server to start for 2 seconds |
| while [ $i -lt $TRIES ]; do |
| if [ -z "$CONNECTED" ]; then |
| echo "Failed to start checkstyle server" |
| # run the actual checkstyle client |
| OUT=$(cat $FILES | nc localhost $(port)) |
| echo "Error connecting to checkstyle server" |