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.
This commit is contained in:
Paul Gschwendtner
2019-06-20 10:21:29 +02:00
committed by Jeremy Elbourn
parent 10cd71a0ed
commit 21594d33e8
6 changed files with 19 additions and 16 deletions
+4
View File
@@ -68,3 +68,7 @@ browserstack-tunnel/BrowserStackLocal -k ${BROWSER_STACK_ACCESS_KEY} ${ARGS} 2>&
# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID
create_ready_file ${!} &
# Wait for all sub processes to finish. This ensures that no zombie
# processes are left over.
wait
+1 -6
View File
@@ -19,10 +19,5 @@ tunnelProcessId=$(cat ${tunnelReadyFile})
# we cannot use killall because CircleCI base container images don't have it installed.
kill ${tunnelProcessId}
while (ps -p ${tunnelProcessId} &> /dev/null); do
printf "."
sleep .5
done
echo ""
echo "Browserstack tunnel has been shut down"
echo "Browserstack tunnel interrupt signal has been sent."