diff --git a/players/join.bat b/players/join.bat index 8129612..ff9f42f 100644 --- a/players/join.bat +++ b/players/join.bat @@ -37,13 +37,25 @@ rem (btl4console.cpp). So OUR child exiting means "the menu handed off", rem NOT "the game closed" -- without this wait the window announced "The rem game has exited" while the game was still loading, which reads as a rem crash to a playtester. Wait for the handed-off generation(s) to go. +rem +rem NO EXTERNAL TOOLS: `find`, `findstr` and `timeout` are all shadowed by +rem Git-Bash / MSYS / GnuWin32 builds of the same names when those are on +rem PATH (a dev box, or a player who installed git). The MSYS `find` is +rem the Unix one and dies with "find: '/I': No such file or directory", +rem and GNU `timeout` takes different arguments. So: parse tasklist with +rem a pure-cmd for/f, and call both helpers by ABSOLUTE System32 path. rem A genuinely dead exe leaves no process and falls straight through, so -rem the #41 launch forensics above still work. +rem the #41 launch forensics above still work. If tasklist is missing +rem entirely the loop degrades to reporting immediately -- the old +rem behaviour, never a hang. rem ------------------------------------------------------------------ :btwait -tasklist /FI "IMAGENAME eq btl4.exe" /NH 2>nul | find /I "btl4.exe" >nul -if not errorlevel 1 ( - timeout /t 2 /nobreak >nul +set "BT_STILL_RUNNING=" +for /f "tokens=1" %%P in ('%SystemRoot%\System32\tasklist.exe /FI "IMAGENAME eq btl4.exe" /NH 2^>nul') do ( + if /I "%%P"=="btl4.exe" set "BT_STILL_RUNNING=1" +) +if defined BT_STILL_RUNNING ( + %SystemRoot%\System32\timeout.exe /t 2 /nobreak >nul 2>nul goto btwait ) echo. diff --git a/players/join_lan.bat b/players/join_lan.bat index 7d36037..185d1c3 100644 --- a/players/join_lan.bat +++ b/players/join_lan.bat @@ -40,13 +40,25 @@ rem (btl4console.cpp). So OUR child exiting means "the menu handed off", rem NOT "the game closed" -- without this wait the window announced "The rem game has exited" while the game was still loading, which reads as a rem crash to a playtester. Wait for the handed-off generation(s) to go. +rem +rem NO EXTERNAL TOOLS: `find`, `findstr` and `timeout` are all shadowed by +rem Git-Bash / MSYS / GnuWin32 builds of the same names when those are on +rem PATH (a dev box, or a player who installed git). The MSYS `find` is +rem the Unix one and dies with "find: '/I': No such file or directory", +rem and GNU `timeout` takes different arguments. So: parse tasklist with +rem a pure-cmd for/f, and call both helpers by ABSOLUTE System32 path. rem A genuinely dead exe leaves no process and falls straight through, so -rem the #41 launch forensics above still work. +rem the #41 launch forensics above still work. If tasklist is missing +rem entirely the loop degrades to reporting immediately -- the old +rem behaviour, never a hang. rem ------------------------------------------------------------------ :btwait -tasklist /FI "IMAGENAME eq btl4.exe" /NH 2>nul | find /I "btl4.exe" >nul -if not errorlevel 1 ( - timeout /t 2 /nobreak >nul +set "BT_STILL_RUNNING=" +for /f "tokens=1" %%P in ('%SystemRoot%\System32\tasklist.exe /FI "IMAGENAME eq btl4.exe" /NH 2^>nul') do ( + if /I "%%P"=="btl4.exe" set "BT_STILL_RUNNING=1" +) +if defined BT_STILL_RUNNING ( + %SystemRoot%\System32\timeout.exe /t 2 /nobreak >nul 2>nul goto btwait ) echo. diff --git a/players/play_solo.bat b/players/play_solo.bat index 57fda3d..a7edf1e 100644 --- a/players/play_solo.bat +++ b/players/play_solo.bat @@ -36,13 +36,25 @@ rem (btl4console.cpp). So OUR child exiting means "the menu handed off", rem NOT "the game closed" -- without this wait the window announced "The rem game has exited" while the game was still loading, which reads as a rem crash to a playtester. Wait for the handed-off generation(s) to go. +rem +rem NO EXTERNAL TOOLS: `find`, `findstr` and `timeout` are all shadowed by +rem Git-Bash / MSYS / GnuWin32 builds of the same names when those are on +rem PATH (a dev box, or a player who installed git). The MSYS `find` is +rem the Unix one and dies with "find: '/I': No such file or directory", +rem and GNU `timeout` takes different arguments. So: parse tasklist with +rem a pure-cmd for/f, and call both helpers by ABSOLUTE System32 path. rem A genuinely dead exe leaves no process and falls straight through, so -rem the #41 launch forensics above still work. +rem the #41 launch forensics above still work. If tasklist is missing +rem entirely the loop degrades to reporting immediately -- the old +rem behaviour, never a hang. rem ------------------------------------------------------------------ :btwait -tasklist /FI "IMAGENAME eq btl4.exe" /NH 2>nul | find /I "btl4.exe" >nul -if not errorlevel 1 ( - timeout /t 2 /nobreak >nul +set "BT_STILL_RUNNING=" +for /f "tokens=1" %%P in ('%SystemRoot%\System32\tasklist.exe /FI "IMAGENAME eq btl4.exe" /NH 2^>nul') do ( + if /I "%%P"=="btl4.exe" set "BT_STILL_RUNNING=1" +) +if defined BT_STILL_RUNNING ( + %SystemRoot%\System32\timeout.exe /t 2 /nobreak >nul 2>nul goto btwait ) echo. diff --git a/players/play_steam.bat b/players/play_steam.bat index 9898125..19284dc 100644 --- a/players/play_steam.bat +++ b/players/play_steam.bat @@ -30,13 +30,25 @@ rem (btl4console.cpp). So OUR child exiting means "the menu handed off", rem NOT "the game closed" -- without this wait the window announced "The rem game has exited" while the game was still loading, which reads as a rem crash to a playtester. Wait for the handed-off generation(s) to go. +rem +rem NO EXTERNAL TOOLS: `find`, `findstr` and `timeout` are all shadowed by +rem Git-Bash / MSYS / GnuWin32 builds of the same names when those are on +rem PATH (a dev box, or a player who installed git). The MSYS `find` is +rem the Unix one and dies with "find: '/I': No such file or directory", +rem and GNU `timeout` takes different arguments. So: parse tasklist with +rem a pure-cmd for/f, and call both helpers by ABSOLUTE System32 path. rem A genuinely dead exe leaves no process and falls straight through, so -rem the #41 launch forensics above still work. +rem the #41 launch forensics above still work. If tasklist is missing +rem entirely the loop degrades to reporting immediately -- the old +rem behaviour, never a hang. rem ------------------------------------------------------------------ :btwait -tasklist /FI "IMAGENAME eq btl4.exe" /NH 2>nul | find /I "btl4.exe" >nul -if not errorlevel 1 ( - timeout /t 2 /nobreak >nul +set "BT_STILL_RUNNING=" +for /f "tokens=1" %%P in ('%SystemRoot%\System32\tasklist.exe /FI "IMAGENAME eq btl4.exe" /NH 2^>nul') do ( + if /I "%%P"=="btl4.exe" set "BT_STILL_RUNNING=1" +) +if defined BT_STILL_RUNNING ( + %SystemRoot%\System32\timeout.exe /t 2 /nobreak >nul 2>nul goto btwait ) echo.