0
votes

The Inno Setup log file does not, by default, include the setup exit code. I am looking for a way to include this in the log file. I am assuming this would be done using the Log function and including it in the DeinitializeSetup event. Something like this:

procedure DeinitializeSetup();
begin
  Log('Exit code: ' + ExitCode);
end;

What I don't know, and cannot seem to find, is how to return the setup exit code, so that I can use it in the Log function. Is this the best way to do this and how do I return the setup exit code?

1
Why do you need that?Martin Prikryl
I want to be able to see if a certain condition has occurred, whereby I set a custom exit code (9), which means that the IntializeSetup has exited due to Windows Updates requiring a reboot.Robert Wigley
If you call ExitProcess, the process is aborted immediately. No Pascal Code is called after, not even the DeinitializeSetup.Martin Prikryl
No, there's no better way, afaik.Martin Prikryl
You can of course log something before you call the ExitProcess.Martin Prikryl

1 Answers

1
votes

There's no way to retrieve the exit code in Pascal Script.

All you can do is to log, if installation was successful or not (what is logged anyway already).

One way to do that is by checking, if the GetCustomSetupExitCode event function was called or not (it's called when exit code would be 0 only).

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;