diff --git a/run.sh b/run.sh index d65fa970..bd2a6751 100755 --- a/run.sh +++ b/run.sh @@ -204,11 +204,13 @@ start_backend() { if [ -f ".env" ]; then uvicorn_env_args=(--env-file .env) fi - # Use a subshell to prefix output - # NOTE: --reload breaks stderr capture (subprocess child loses the 2>&1 pipe). + # PYTHONUNBUFFERED=1 prevents stderr buffering when piped through sed. + # Without it, JSON logs from superset_tools_app get stuck in the buffer + # and never appear in real time (or at all, for small log lines). + # NOTE: --reload also breaks stderr capture (subprocess child loses the pipe). # For hot-reload during development, run uvicorn directly instead: # cd backend && source .venv/bin/activate && uvicorn src.app:app --reload --port 8000 - python3 -m uvicorn src.app:app --port "$BACKEND_PORT" "${uvicorn_env_args[@]}" 2>&1 | sed "s/^/$(echo -e '\033[0;34m[Backend]\033[0m ') /" & + PYTHONUNBUFFERED=1 python3 -m uvicorn src.app:app --port "$BACKEND_PORT" "${uvicorn_env_args[@]}" 2>&1 | sed "s/^/$(echo -e '\033[0;34m[Backend]\033[0m ') /" & BACKEND_PID=$! cd .. }