2016-01-14 11:29:50 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2016-12-01 23:06:32 +01:00
|
|
|
TUNNEL_LOG="$LOGS_DIR/browserstack-tunnel.log"
|
2016-01-14 11:29:50 -08:00
|
|
|
|
|
|
|
|
# Wait for Connect to be ready before exiting
|
2016-11-08 21:27:28 +01:00
|
|
|
# Time out if we wait for more than 2 minutes, so the process won't run forever.
|
2016-01-14 11:29:50 -08:00
|
|
|
let "counter=0"
|
|
|
|
|
|
2016-12-01 23:06:32 +01:00
|
|
|
# Exit the process if there are errors reported. Print the tunnel log to the console.
|
|
|
|
|
if [ -f $BROWSER_PROVIDER_ERROR_FILE ]; then
|
|
|
|
|
echo
|
|
|
|
|
echo "An error occurred while starting the tunnel. See error:"
|
|
|
|
|
cat $TUNNEL_LOG
|
|
|
|
|
exit 5
|
|
|
|
|
fi
|
|
|
|
|
|
2016-01-14 11:29:50 -08:00
|
|
|
while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
|
|
|
|
|
let "counter++"
|
2016-11-08 21:27:28 +01:00
|
|
|
|
2016-01-14 11:29:50 -08:00
|
|
|
if [ $counter -gt 240 ]; then
|
2016-11-08 21:27:28 +01:00
|
|
|
echo
|
|
|
|
|
echo "Timed out after 2 minutes waiting for tunnel ready file"
|
2016-01-14 11:29:50 -08:00
|
|
|
exit 5
|
|
|
|
|
fi
|
2016-11-08 21:27:28 +01:00
|
|
|
|
|
|
|
|
printf "."
|
2016-01-14 11:29:50 -08:00
|
|
|
sleep .5
|
|
|
|
|
done
|