Use netcat check to wait for python

This commit is contained in:
Juliano Solanho 2020-11-09 11:47:42 -03:00
parent 623658886e
commit 038f6885bb
2 changed files with 10 additions and 4 deletions

View File

@ -3,14 +3,19 @@ set -euo pipefail
# start a web server in the background and tear it down when exiting
./script/serve.sh public &
# Wait for the python server to launch since we're launching it async
sleep 3
SERVER_PID=$!
cleanup() {
kill "$SERVER_PID"
}
trap cleanup EXIT INT
# Wait for the python server to launch since we're launching it async
>&2 echo "Waiting for web server to launch on port 8000..."
while ! nc -z localhost 8000 &>/dev/null; do
>&2 echo "Web server not up yet... waiting some more..."
sleep 1
done
>&2 echo "Web server launched"
node script/axe-puppeteer.js http://localhost:8000

View File

@ -31,6 +31,7 @@ stdenv.mkDerivation {
# stuff we need for running builds in a `nix-shell --pure` environment.
which
netcat-gnu
] ++ lib.optionals stdenv.isLinux [ pkgs.fsatrace pkgs.strace pkgs.cacert ];
# environment variables