@@ -4,69 +4,66 @@ set -e -o pipefail
44
55# Workaround for Travis CI cookbook https://github.com/travis-ci/travis-ci/issues/4862,
66# where $PATH will be extended with relative paths to the NPM binaries.
7- PATH=` echo $PATH | sed -e ' s/:\.\/node_modules\/\.bin//' `
7+ PATH=` echo ${ PATH} | sed -e ' s/:\.\/node_modules\/\.bin//' `
88
99TUNNEL_FILE=" BrowserStackLocal-linux-x64.zip"
10- TUNNEL_URL=" https://www.browserstack.com/browserstack-local/$TUNNEL_FILE "
10+ TUNNEL_URL=" https://www.browserstack.com/browserstack-local/${ TUNNEL_FILE} "
1111TUNNEL_DIR=" /tmp/browserstack-tunnel"
12- TUNNEL_LOG=" $LOGS_DIR /browserstack-tunnel.log"
12+ TUNNEL_LOG=" ${ LOGS_DIR} /browserstack-tunnel.log"
1313
14- BROWSER_STACK_ACCESS_KEY=` echo $BROWSER_STACK_ACCESS_KEY | rev`
14+ BROWSER_STACK_ACCESS_KEY=` echo ${ BROWSER_STACK_ACCESS_KEY} | rev`
1515
1616# Cleanup and create the folder structure for the tunnel connector.
17- rm -rf $TUNNEL_DIR $ BROWSER_PROVIDER_READY_FILE
18- mkdir -p $TUNNEL_DIR
19- touch $TUNNEL_LOG
17+ rm -rf ${ TUNNEL_DIR} ${ BROWSER_PROVIDER_READY_FILE}
18+ mkdir -p ${ TUNNEL_DIR}
19+ touch ${ TUNNEL_LOG}
2020
21- cd $TUNNEL_DIR
21+ cd ${ TUNNEL_DIR}
2222
2323# Download the browserstack local binaries.
24- curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null
24+ curl ${ TUNNEL_URL} -o ${ TUNNEL_FILE} 2> /dev/null 1> /dev/null
2525
2626# Extract the browserstack local binaries from the tarball.
2727mkdir -p browserstack-tunnel
28- unzip -q $TUNNEL_FILE -d browserstack-tunnel
28+ unzip -q ${ TUNNEL_FILE} -d browserstack-tunnel
2929
3030# Cleanup the download directory.
31- rm $TUNNEL_FILE
31+ rm ${ TUNNEL_FILE}
3232
3333ARGS=" "
3434
3535# Set tunnel-id only on Travis, to make local testing easier.
36- if [ ! -z " $TRAVIS_JOB_ID " ]; then
37- ARGS=" $ARGS --local-identifier $TRAVIS_JOB_ID "
36+ if [ ! -z " ${ TRAVIS_JOB_ID} " ]; then
37+ ARGS=" ${ ARGS} --local-identifier ${ TRAVIS_JOB_ID} "
3838fi
3939
40- echo " Starting Browserstack Local in the background, logging into:"
41- echo " $TUNNEL_LOG "
42- echo " ---"
43- echo " $ARGS "
40+ echo " Starting Browserstack Local in the background, logging into: ${TUNNEL_LOG} "
4441
4542# Extension to the BrowserStackLocal binaries, because those can't create a readyfile.
4643function create_ready_file {
4744
4845 # To be able to exit the tail properly we need to have a sub shell spawned, which is
4946 # used to track the state of tail.
50- { sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE ; } &
47+ { sleep 120; touch ${ BROWSER_PROVIDER_ERROR_FILE} ; } &
5148
52- TIMER_PID=$!
49+ TIMER_PID=${ ! }
5350
5451 # Disown the background process, because we don't want to show any messages when killing
5552 # the timer.
5653 disown
5754
5855 # When the tail recognizes the `Ctrl-C` log message the BrowserStack Tunnel is up.
5956 {
60- tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed ' /Ctrl/q' && kill -9 $TIMER_PID ; };
57+ tail -n0 -f ${ TUNNEL_LOG} --pid ${ TIMER_PID} | { sed ' /Ctrl/q' && kill -9 ${ TIMER_PID} ; };
6158 } & > /dev/null
6259
6360 echo
6461 echo " BrowserStack Tunnel ready"
6562
66- touch $BROWSER_PROVIDER_READY_FILE
63+ touch ${ BROWSER_PROVIDER_READY_FILE}
6764}
6865
69- browserstack-tunnel/BrowserStackLocal -k $BROWSER_STACK_ACCESS_KEY $ ARGS & >> $TUNNEL_LOG &
66+ browserstack-tunnel/BrowserStackLocal -k ${ BROWSER_STACK_ACCESS_KEY} ${ ARGS} 2>&1 >> ${ TUNNEL_LOG} &
7067
7168# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID
7269create_ready_file &
0 commit comments