diff --git a/ethend.bat b/ethend.bat index 783abf9..0f1835a 100644 --- a/ethend.bat +++ b/ethend.bat @@ -122,11 +122,18 @@ if %ERRORLEVEL%==0 ( exit /b 0 ) -:: Free port +:: Check port conflict and ask user for /f "tokens=5" %%a in ('netstat -ano ^| findstr /R ":%ETHEND_PORT% " ^| findstr "LISTENING"') do ( - echo [WARN] Port %ETHEND_PORT% in use by PID %%a, releasing... + echo. + echo [WARN] Port %ETHEND_PORT% is in use by PID %%a. + 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 - timeout /t 1 /nobreak >nul + timeout /t 2 /nobreak >nul ) cd /d "%ETHEND_DIR%"