Files
angular__angular/scripts/browserstack/stop-tunnel.sh
T
Paul Gschwendtner 21594d33e8 build: properly wait for external browser tunnels to terminate
We currently wait for browser tunnels of Saucelabs and Browserstack
to terminate by repeatedly checking with `ps -p`. This is not reliable and
can break if the host system is not removing forcibly killed child processes
from the process table. This is valid since the tunnels are launched as child
processes and we ideally wait for those to terminate using the `wait` command.
2019-06-21 09:34:21 -07:00

24 lines
684 B
Bash
Executable File

#!/bin/bash
set -e -o pipefail
tunnelTmpDir="/tmp/material-browserstack"
tunnelReadyFile="${tunnelTmpDir}/readyfile"
if [[ ! -f ${tunnelReadyFile} ]]; then
echo "BrowserStack tunnel has not been started. Cannot stop tunnel.."
exit 1
fi
echo "Shutting down Browserstack tunnel.."
# 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}
echo ""
echo "Browserstack tunnel interrupt signal has been sent."