@echo off
REM Ghost Node Auto-Restart Wrapper
REM This script is called by the restart API endpoint
REM It spawns a fresh Python process and exits

setlocal enabledelayedexpansion

REM Get the directory of this script
cd /d "%~dp0"

echo.
echo ========================================
echo Ghost Node Auto-Restart
echo ========================================
echo [Spawn] Starting new process...
echo [Spawn] Command: python worker.py
echo.

REM Spawn the new process in background (detached)
REM This runs completely independently
start "" /B /MIN python worker.py

REM Give it a moment to start
timeout /t 1 /nobreak >nul

REM Exit this wrapper
echo [Spawn] New process spawned. Wrapper exiting.
exit /b 0
