RunUBT.bat loses negative error codes from UnreaBuildTool.dll. This means that any program that executes RunUBT.bat cannot detect an unhandled exception and instead thinks RunUBT.bat succeeded.
Steps to Reproduce
Delete the Build.version file in the Build folder. This will cause UnrealBuildTool.dll to encounter an unhandled exception. (not the problem)
Now run RunUBT.bat for the project. UnrealBuildTool.dll will encounter the exception and return a negative error code.
What is supposed to happen is UnrealBuildTool should be catching the exception and returning one of it’s standardized error exit codes that are always greater than zero but you’ve found an edge case that does not. Regardless you’re correct the batch should be checking if non-zero and I’ll fix that.
Static initialization of a property was throwing an exception when Build.version didn’t exist which was preventing the exception from being handled. I’ve fixed this for 5.7.