2016-01-14 11:29:50 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
set -e -o pipefail
|
|
|
|
|
|
2018-10-25 00:35:06 +02:00
|
|
|
tunnelTmpDir="/tmp/material-browserstack"
|
|
|
|
|
tunnelReadyFile="${tunnelTmpDir}/readyfile"
|
2016-01-14 11:29:50 -08:00
|
|
|
|
2018-10-25 00:35:06 +02:00
|
|
|
if [[ ! -f ${tunnelReadyFile} ]]; then
|
|
|
|
|
echo "BrowserStack tunnel has not been started. Cannot stop tunnel.."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-11-08 21:27:40 +01:00
|
|
|
|
2018-10-25 00:35:06 +02:00
|
|
|
echo "Shutting down Browserstack tunnel.."
|
2016-11-08 21:27:40 +01:00
|
|
|
|
2018-10-25 00:35:06 +02:00
|
|
|
# The process id for the BrowserStack local instance is stored inside of the readyfile.
|
|
|
|
|
tunnelProcessId=$(cat ${tunnelReadyFile})
|
|
|
|
|
|
|
|
|
|
# Kill the process by using the PID that has been read from the readyfile. Note that
|
|
|
|
|
# we cannot use killall because CircleCI base container images don't have it installed.
|
|
|
|
|
kill ${tunnelProcessId}
|
|
|
|
|
|
2016-11-08 21:27:40 +01:00
|
|
|
echo ""
|
2019-06-20 10:21:29 +02:00
|
|
|
echo "Browserstack tunnel interrupt signal has been sent."
|