website testing: swapped out trap in website testing script for a simpler error catch

This commit is contained in:
Chris Baker 2018-10-09 16:06:12 -04:00
parent 6cd30be1e7
commit d7aa8e6285

View file

@ -12,9 +12,13 @@ WEBSITE_CID=$(docker run \
--publish "35729:35729" \
--volume "$PWD:/website" \
hashicorp/middleman-hashicorp:${MMVERSION})
echo "Website running in container ${WEBSITE_CID}."
trap 'echo Killing docker website container... && docker kill ${WEBSITE_CID}' EXIT HUP INT QUIT TERM
echo "Website is launching in container ${WEBSITE_CID}."
echo "Checking website for dead links using recursive wget..."
wget -nv --recursive --level=10 --delete-after http://localhost:4567
wget -nv --recursive --level=10 --delete-after http://localhost:4567 && exit_code=$? || exit_code=$?
echo "wget exit code: ${exit_code}"
echo "Killing docker website container ${WEBSITE_CID}..."
docker kill ${WEBSITE_CID} || true
exit ${exit_code}