From 6cbb3e3e800a8ef3814bc453ed551c9c49b659ef Mon Sep 17 00:00:00 2001 From: AskaEth Date: Sun, 28 Jun 2026 16:50:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ethend.bat=20=E7=AB=AF=E5=8F=A3=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=94=B9=E7=94=A8=E5=8F=98=E9=87=8F=E9=81=BF=E5=85=8D?= =?UTF-8?q?for=E5=BE=AA=E7=8E=AF=E5=86=85=E4=BA=A4=E4=BA=92=E9=97=AA?= =?UTF-8?q?=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ethend.bat | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ethend.bat b/ethend.bat index 81b66e7..a64af94 100644 --- a/ethend.bat +++ b/ethend.bat @@ -126,17 +126,19 @@ if %ERRORLEVEL%==0 ( exit /b 0 ) -:: Check port conflict and ask user -for /f "tokens=5" %%a in ('netstat -ano ^| findstr /R ":%ETHEND_PORT% " ^| findstr "LISTENING"') do ( +:: Check port conflict +set FOUND_PID= +for /f "tokens=5" %%a in ('netstat -ano ^| findstr /R ":%ETHEND_PORT% " ^| findstr "LISTENING"') do set FOUND_PID=%%a +if not "%FOUND_PID%"=="" ( echo. - echo [WARN] Port %ETHEND_PORT% is in use by PID %%a. + echo [WARN] Port %ETHEND_PORT% is in use by PID %FOUND_PID%. set /p CHOICE="Kill old process and restart? [Y/n]: " if /i "!CHOICE!"=="n" ( echo [INFO] Aborted by user. exit /b 0 ) - echo [INFO] Killing PID %%a... - taskkill /PID %%a /F >nul 2>&1 + echo [INFO] Killing PID %FOUND_PID%... + taskkill /PID %FOUND_PID% /F >nul 2>&1 timeout /t 2 /nobreak >nul )