应用程序阻止安装程序返回退出代码 [英] Application prevents installer from returning Exit Code

查看:112
本文介绍了应用程序阻止安装程序返回退出代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有奇怪的问题.我有安装程序,可以正常运行.我正在使用PowerShell启动它,类似

Got weird problem. I have installer, which works just fine. I'm launching it with PowerShell, something like

$p = 'Start-Process $path -Verb "RunAs" -PassThru -Wait'
$p = Invoke-Expression $p

并获得其退出代码为$p.ExitCode 通常,这一切都很完美.但是我已经在CurStepChangedCurStepChanged中添加了ShellExec,以便在安装完成后启动其他可执行文件.

and getting its exit code as $p.ExitCode Usually it all works perfect. But I've added ShellExec in CurStepChanged, for ssPostInstall step, to launch additional executable after installation finish.

ShellExec('', ExpandConstant('{app}\DentalDesktopServerAgent.exe'), '', '', SW_HIDE, ewNoWait, ResultCode);

并且,它不再返回退出代码. 此行是有退出代码和没有退出代码的安装程序之间的唯一区别.而且由于PowerShell脚本正在等待退出代码,因此它只会挂起.

And with this, it does no longer return exit code. This line is the only difference between installer with and without exit code. And since PowerShell script is waiting for exit code, it simply hangs.

那么,ShellExec为什么会影响退出代码?有什么想法吗?

So, why does ShellExec impact exit code? Any ideas?

更新: 看来,问题不在于ShellExec,而在于启动的应用程序本身.应用程序本身不应该被关闭(它是主要安装的应用程序的助手应用程序).我试图将其移至[运行],看来,该应用程序未返回退出代码(显而易见).但是我不确定这会导致安装程序不返回自己的退出代码,因为即使将应用程序启动移至bat文件之后,当bat文件在应用程序启动后立即返回退出代码时,安装程​​序仍不会返回退出代码,尽管它的所有[运行]条目都可以.

Update: It seems, problem is not in ShellExec, but in launched application itself. Application itself is not supposed to be closed (it is helper application for main installed application). I've tried to move it to [Run], and it seems, that application does not return exit code (thats obvious). But I'm not sure, that this causes installer to not return its own exit code, since even after moving launching of application to bat file, when bat file returns exit code right after application was started, installer still does not return exit code, although all its [Run] entry do.

更新: 传入其他信息.记录Exec的结果代码,该代码将启动应用程序.代码为259,表示申请仍在进行中".可能会影响安装程序的结果代码吗?

Update: Additional info incoming. Logged result code of Exec, which launches application. Code is 259, which means "application still in progress". Is it possible, that it impacts result code of installer?

推荐答案

昨天我不太清楚您的问题.似乎是Invoke-Expression给您带来麻烦.尝试以正常方式启动安装程序(只需在批处理文件中说明其路径),然后检查PowerShell变量$ LastExitCode.

I did not read your question very well yesterday. It seems it is the Invoke-Expression that is giving you trouble. Try launching your installer the normal way (by just stating its path as in a batch file) and then check PowerShell variable $LastExitCode.

我假设您知道要与哪些退出代码进行比较: http://www.jrsoftware.org/ishelp/index.php?topic=setupexitcodes

I assume you know what exit codes to compare to: http://www.jrsoftware.org/ishelp/index.php?topic=setupexitcodes

这篇关于应用程序阻止安装程序返回退出代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆