@mytec: before 3.0 REFACTOR

This commit is contained in:
2026-02-01 14:26:17 +02:00
parent acc90fe538
commit 1dde56705a
13 changed files with 1759 additions and 61 deletions

View File

@@ -0,0 +1,93 @@
@echo off
title RFCP Debug Launcher + Monitor
setlocal EnableDelayedExpansion
echo ============================================
echo RFCP Debug Launcher + Monitor
echo ============================================
echo.
:: Kill any running instance
echo [1/3] Cleaning up existing processes...
taskkill /F /IM rfcp-server.exe 2>nul
if %ERRORLEVEL% EQU 0 (
echo Killed existing rfcp-server.exe
timeout /t 2 /nobreak >nul
) else (
echo No existing process found
)
echo.
:: Environment setup
set PYTHONUNBUFFERED=1
set RFCP_DEBUG=1
set RFCP_HOST=127.0.0.1
set RFCP_PORT=8888
echo [2/3] Environment:
echo PYTHONUNBUFFERED=%PYTHONUNBUFFERED%
echo RFCP_DEBUG=%RFCP_DEBUG%
echo RFCP_HOST=%RFCP_HOST%
echo RFCP_PORT=%RFCP_PORT%
echo.
:: Find executable
if exist "%~dp0dist\rfcp-server.exe" (
set EXE_PATH=%~dp0dist\rfcp-server.exe
set WORK_DIR=%~dp0dist
) else if exist "%~dp0rfcp-server.exe" (
set EXE_PATH=%~dp0rfcp-server.exe
set WORK_DIR=%~dp0
) else (
echo [ERROR] rfcp-server.exe not found!
pause
exit /b 1
)
echo [3/3] Starting server...
echo Executable: %EXE_PATH%
echo Working dir: %WORK_DIR%
echo.
:: Create log directory
set LOG_DIR=%WORK_DIR%\logs
if not exist "%LOG_DIR%" mkdir "%LOG_DIR%"
:: Log file with timestamp
set TIMESTAMP=%date:~-4%%date:~3,2%%date:~0,2%-%time:~0,2%%time:~3,2%%time:~6,2%
set TIMESTAMP=%TIMESTAMP: =0%
set LOG_FILE=%LOG_DIR%\server-%TIMESTAMP%.log
echo Log file: %LOG_FILE%
echo.
echo ============================================
echo SERVER OUTPUT (also saved to log)
echo ============================================
echo.
cd /d "%WORK_DIR%"
:: Run server and tee to log file
:: Note: PowerShell tee for dual output
powershell -Command "& '%EXE_PATH%' 2>&1 | Tee-Object -FilePath '%LOG_FILE%'"
echo.
echo ============================================
echo Server stopped
echo Log saved to: %LOG_FILE%
echo ============================================
:: Post-mortem check
echo.
echo [POST-MORTEM] Checking for orphan processes...
for /f %%a in ('tasklist /FI "IMAGENAME eq rfcp-server.exe" 2^>nul ^| find /c "rfcp-server"') do (
if %%a GTR 0 (
echo WARNING: %%a rfcp-server process(es) still running!
echo Run: taskkill /F /IM rfcp-server.exe
) else (
echo All processes cleaned up properly.
)
)
echo.
pause