当Inno Setup安装失败时(在安装程序本身内),如何调用exe? [英] How to call an exe when Inno Setup installation fails (within the installer itself)?
问题描述
我已经使用Inno Setup几个月了,但是我一直在努力寻找如何从安装程序本身内部检测导致Inno Setup以非零退出代码结束的错误. /p>
我曾经考虑过将CurStepChanged
与ssDone
甚至是DeinitializeSetup
一起使用,但是我找不到如何访问向导的退出代码.
我错过了什么吗?一定有办法做到这一点...
您无法从Pascal脚本中找到安装程序退出代码.
如果要检测安装程序失败,请记住是否用ssDone
调用了CurStepChanged
并在DeinitializeSetup
中进行了测试.
var
Succeeded: Boolean;
procedure DeinitializeSetup();
begin
if Succeeded then
begin
Log('Installation succeeded');
end
else
begin
Log('Installation failed');
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssDone then
begin
Succeeded := True;
end;
end;
在某些情况下,即使安装程序失败也使用ssDone
.
例如,当由于未重新启动计算机而无法完成先前的安装而导致失败时.在这种情况下,CurStepChanged
不会与ssPostInstall
一起调用.因此,如果这种情况在安装程序中可能发生,您可能要检查两个步骤.
I've been using Inno Setup for several months now, but I'm struggling to find how to detect, from within the installer itself, an error that would cause Inno Setup to end with a non-zero exit code.
I've thought about using CurStepChanged
with the ssDone
step, or even DeinitializeSetup
, but I can't find how to get access to the wizard's exit-code.
Did I miss something? There must be a way to do it...
You cannot find out installer exit code from the Pascal Scripting.
If you want to detect that the installer failed, remember if CurStepChanged
was called with ssDone
and test that in DeinitializeSetup
.
var
Succeeded: Boolean;
procedure DeinitializeSetup();
begin
if Succeeded then
begin
Log('Installation succeeded');
end
else
begin
Log('Installation failed');
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssDone then
begin
Succeeded := True;
end;
end;
There are edge cases, when ssDone
is used even, if the installer fails.
For example, when it fails because a machine was not restarted to complete the previous installation. In this case the CurStepChanged
is not called with ssPostInstall
. So you may want to check for both steps, if this scenario can happen in your installer.
这篇关于当Inno Setup安装失败时(在安装程序本身内),如何调用exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!