headless-build.bat bug: Headless build freezes for 20 seconds after "Build Finished"
- April 23, 2024
- 1 reply
- 1566 views
I have a .cmd script to do headless builds on Windows 11:
@Echo off
echo incrementally building...
set PROJECT_DIR=%cd%\..
set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug
set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%
C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%
exit /b %ERRORLEVEL%
It builds perfectly:
13:31:22 Build Finished. 0 errors, 0 warnings. (took 3s.227ms)
After this the command prompt sometimes hangs for about 20 seconds. But not always.
First build after switching between TouchGFX, command prompt or STM32CubeIDE freezes 20 seconds (in TouchGFX or command prompt), subsequent builds don't freeze until I switch again. This is not a big deal as it's only the first build, but I still like to have it fixed. I tried many things:
- starting it with START "" /WAIT /B
- starting it with START "" /WAIT /B /HIGH
- copying the contents of the headless-build.bat (so directly calling the executable instead of another bat file)
- removing post build commands
- disabling multithreaded build
- closing project in STM32CubeIDE or closing STM32CubeIDE after building there
I've attached a simple project that replicates the issue. The project is simpler and the delay is only 5 seconds after build after switching. I've removed the Middlewares folder or else the archive would be 256MiB. It's just a project generated from TouchGFX for the STM32H735G-DK with slight modifications
