# HG changeset patch # User Wuzzy # Date 1531830058 -7200 # Node ID b5f8864a38d33ca78179f17a1f5b31b3f39a5352 # Parent 424944a835a70f0ab59f88b256a4c801634e77b0 Add proper exit codes when halt-ing hwengine due to error diff -r 424944a835a7 -r b5f8864a38d3 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Jul 17 12:55:07 2018 +0200 +++ b/hedgewars/uConsts.pas Tue Jul 17 14:20:58 2018 +0200 @@ -37,6 +37,7 @@ HaltFatalError = 52; HaltStartupError = 53; HaltFatalErrorNoIPC = 54; + HaltVideoRec = 55; // for automatic tests HaltTestSuccess = 0; diff -r 424944a835a7 -r b5f8864a38d3 hedgewars/uRender.pas --- a/hedgewars/uRender.pas Tue Jul 17 12:55:07 2018 +0200 +++ b/hedgewars/uRender.pas Tue Jul 17 14:20:58 2018 +0200 @@ -527,7 +527,10 @@ {$IFNDEF PAS2C} if not Load_GL_VERSION_2_0 then - halt; + begin + WriteLnToConsole('Load_GL_VERSION_2_0 returned false!'); + halt(HaltStartupError); + end; {$ENDIF} shaderWater:= CompileProgram('water'); diff -r 424944a835a7 -r b5f8864a38d3 hedgewars/uVideoRec.pas --- a/hedgewars/uVideoRec.pas Tue Jul 17 12:55:07 2018 +0200 +++ b/hedgewars/uVideoRec.pas Tue Jul 17 14:20:58 2018 +0200 @@ -48,7 +48,7 @@ procedure freeModule; implementation -uses uVariables, GLunit, SDLh, SysUtils, uUtils, uIO, uMisc, uTypes, uDebug; +uses uVariables, GLunit, SDLh, SysUtils, uUtils, uIO, uMisc, uConsts, uTypes, uDebug; type TAddFileLogRaw = procedure (s: pchar); cdecl; const AvwrapperLibName = 'libavwrapper'; @@ -153,7 +153,10 @@ FreeMem(RGB_Buffer, 4*numPixels); Close(cameraFile); if AVWrapper_Close() < 0 then - halt(-1); + begin + AddFileLog('AVWrapper_Close() has failed.'); + halt(HaltVideoRec); + end; Erase(cameraFile); if recordAudio then DeleteFile(soundFilePath); @@ -167,7 +170,10 @@ glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, RGB_Buffer); if AVWrapper_WriteFrame(RGB_Buffer) < 0 then - halt(-1); + begin + AddFileLog('AVWrapper_WriteFrame(RGB_Buffer) has failed.'); + halt(HaltVideoRec); + end; // inform frontend that we have encoded new frame s[0]:= #3;