integration.sh 908 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # Change directory to the first argument passed to the script
  3. pushd "$1" || exit 1
  4. echo "Changed directory to $1"
  5. # So we get stdout / stderr from Python ASAP. Without this, delays can be very long (e.g. on Windows, Github Actions)
  6. export PYTHONUNBUFFERED=1
  7. # Start the server in the background
  8. reflex run --loglevel debug --env "$2" & pid=$!
  9. # Within the context of this bash, $pid_in_bash is what we need to pass to "kill" on exit
  10. # This is true on all platforms.
  11. pid_in_bash=$pid
  12. trap "kill -INT $pid_in_bash ||:" EXIT
  13. echo "Started server with PID $pid"
  14. # Assume we run from the root of the repo
  15. popd
  16. # In Windows, our Python script below needs to work with the WINPID
  17. if [ -f /proc/$pid/winpid ]; then
  18. pid=$(cat /proc/$pid/winpid)
  19. echo "Windows detected, passing winpid $pid to port waiter"
  20. fi
  21. python scripts/wait_for_listening_port.py 3000 8000 --timeout=600 --server-pid "$pid"