-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
32 lines (29 loc) · 778 Bytes
/
start.bat
File metadata and controls
32 lines (29 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@echo off
REM Check for cargo existance
where cargo >nul 2>nul
if %errorlevel% neq 0 (
echo ERROR: Cargo not found! Install rust first!!!
pause
exit /b 1
)
REM Try to kill process on port 3000 (safer approach)
for /f "tokens=5" %%a in ('netstat -ano ^| findstr /R /C:":3000 *LISTENING"') do (
echo Found process on port 3000, attempting to terminate...
taskkill /F /PID %%a >nul 2>nul
if %errorlevel% equ 0 (
echo Successfully terminated process on port 3000
) else (
echo No process was using port 3000
)
)
REM Run project
echo Starting server...
cargo run
if %errorlevel% neq 0 (
echo FATAL ERROR: Server failed to start!!!
pause
exit /b 1
)
REM This will never execute because cargo run blocks
echo Done!!!
pause