默认情况下,Inno 安装程序日志文件不包含安装程序退出代码。我正在寻找一种将其包含在日志文件中的方法。我假设这将使用 Log
函数并将其包含在 DeinitializeSetup
事件中。像这样:
procedure DeinitializeSetup();
begin
Log('Exit code: ' + ExitCode);
end;
我不知道,似乎也找不到的是如何返回安装程序退出代码,以便我可以在Log
函数中使用它。这是执行此操作的最佳方法吗,如何返回安装程序退出代码?
无法
在 Pascal 脚本中检索退出代码。
您所能做的就是记录安装是否成功(无论如何已经记录了什么)。
一种方法是检查是否调用了 GetCustomSetupExitCode
事件函数(当退出代码仅为 0 时调用)。
var
ZeroExitCode: Boolean;
function GetCustomSetupExitCode: Integer;
begin
ZeroExitCode := True;
Result := 0;
end;
procedure DeinitializeSetup();
begin
if ZeroExitCode then
Log('Zero exit code')
else
Log('Non-zero exit code');
end;