Possibility to synchronize a setup with Inno Setup and read out return code
is it possible to start a Inno Setup, that waits until the child process has finished? The current systems default behaviour is that the setup starts the "real" setup in temporary folder and goes further in command line. My aim is that the parent proces开发者_运维技巧s should wait until the child finishes to read out the return code in errorlevel variable. I've made a picture for better understanding
My 2nd question is how Inno handles the setup exit codes. Where can they read out after setup has finished? If an error occurs in setup or user clicks cancel the env-variable %errorlevel%
is always 0.
Thanks in advance
What you are trying to do is a function of the OS, not really InnoSetup. Use the following to do what you want from a command prompt or batch file:
start /wait setup.exe
echo %ERRORLEVEL%
The following code sample calls child.exe
during the post-install
step:
procedure CurStepChanged(CurStep: TSetupStep);
var
ErrorCode: integer;
begin
if (CurStep = ssPostInstall) then
begin
WizardForm.Hide;
ShellExec('open', 'child.exe', '', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
WizardForm.Show;
if (ErrorCode <> 0) then
begin
// error handling
end;
end;
end;
精彩评论