fix: replace complex bat scripts with Python launcher + minimal bat wrappers

Root cause: Windows batch files written with LF endings caused cmd.exe to
misparse labels and Chinese characters, producing garbled "not a command"
errors. The Python launcher avoids encoding issues entirely.

- start.py: reliable cross-platform launcher (kill ports, start 3 services,
  wait for health, print status)
- start.bat / start_all.bat: minimal 4-line ASCII wrappers
- stop.bat: inline Python for port-based process killing
This commit is contained in:
2026-05-23 09:32:32 +08:00
parent c8924c625c
commit c2cae5665e
4 changed files with 150 additions and 193 deletions
+16 -25
View File
@@ -1,27 +1,18 @@
@echo off
chcp 65001 >nul
echo ================================================
echo 停止所有 agent_jrxml 服务
echo ================================================
echo [停止] 按窗口标题清理...
taskkill /F /FI "WINDOWTITLE eq jrxml-validator*" 2>nul
taskkill /F /FI "WINDOWTITLE eq jrxml-api*" 2>nul
taskkill /F /FI "WINDOWTITLE eq jrxml-frontend*" 2>nul
echo [停止] 按端口清理...
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":8000.*LISTENING"') do (
echo 端口 8000 - PID %%a
taskkill /F /PID %%a >nul 2>&1
)
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":8001.*LISTENING"') do (
echo 端口 8001 - PID %%a
taskkill /F /PID %%a >nul 2>&1
)
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":5173.*LISTENING"') do (
echo 端口 5173 - PID %%a
taskkill /F /PID %%a >nul 2>&1
)
echo 已停止
cd /d "%~dp0"
.venv\Scripts\python.exe -c "
import os, signal, subprocess
ports = (8000, 8001, 5173)
for port in ports:
try:
r = subprocess.run(['netstat', '-ano'], capture_output=True, text=True)
for line in r.stdout.splitlines():
if f':{port}' in line and 'LISTENING' in line:
pid = int(line.split()[-1])
print(f'Killing PID {pid} on port {port}')
os.kill(pid, signal.SIGTERM)
except Exception as e:
print(f'Port {port}: {e}')
print('Done')
"
pause