Fix Admin UI status detection to catch port binding errors

- Increase sleep time to 2 seconds to allow error detection
- Check log file for 'Address already in use' error
- Show helpful message to run --kill-ports when port is in use
- Kill the failed process to prevent zombie processes
This commit is contained in:
Timur Gordon
2025-11-07 00:26:07 +01:00
parent 4f4d1c0832
commit 43750b32d7

View File

@@ -146,10 +146,19 @@ if ! command -v trunk &> /dev/null; then
else
trunk serve --port "$ADMIN_UI_PORT" > /tmp/supervisor-ui.log 2>&1 &
ADMIN_UI_PID=$!
sleep 1
sleep 2
# Check if process is still running
if ps -p $ADMIN_UI_PID > /dev/null 2>&1; then
echo "✅"
UI_STARTED=true
# Check for port binding errors in log
if grep -q "Address already in use" /tmp/supervisor-ui.log 2>/dev/null; then
echo "❌"
UI_ERROR="Port $ADMIN_UI_PORT already in use. Run: ./scripts/run.sh --kill-ports"
kill $ADMIN_UI_PID 2>/dev/null
else
echo "✅"
UI_STARTED=true
fi
else
echo "❌"
UI_ERROR="Failed to start"