如何执行另一个 NSIS 安装程序并等待它完成?
我正在 NSIS 中编写一个安装程序,它是另一个使用 NSIS 创建的安装程序的包装器。 内部安装程序不是我的。它是使用 BioWare Installer 1.03 (NSIS 2.34) 创建的。它可能会以某种方式损坏,但我无法修改它!我的安装程序所做的是,它只是修改一些注册表值(否则“内部”安装程序将无法运行),然后执行安装程序,然后覆盖一些文件,然后恢复以前的注册表值。
我的问题:我不知道如何实际等待“内部”安装程序完成!这是因为安装程序首先解压其内容并创建一个新进程,这才是真正的安装程序。第一个进程(解包)完成后,代码就会立即执行。等待在这里至关重要,因为我需要覆盖一些文件。
我读过这个:http://nsis.sourceforge.net/When_I_use_ExecWait,_it_doesn't_wait,但我找不到 NSIS 安装程序的任何开关。
我尝试过 ExecWait 和 nsExec::Exec,但它们都没有等待真正的安装程序,只是等待第一个进程完成。
I'm writing an installer in NSIS, which is kind of a wrapper for another installer, created with NSIS. The inner installer is not mine. It's created with BioWare Installer 1.03 (NSIS 2.34). It may be broken somehow, but I can't modify it! What my installer does is that it simply modifies some registry values (otherwise the "inner" installer won't run), then executes the installer, then overwrites some files and then restores the previous registry values.
My problem: I have no idea how to actually wait for the "inner" installer to finish! It's because the installer first unpacks it's content and creates a new process, which is the real installer. And the code executes as soon as the first process (unpacking) finishes. Waiting is crucial here, because I need to overwrite some files.
I have read this: http://nsis.sourceforge.net/When_I_use_ExecWait,_it_doesn't_wait, but I can't find any switches for NSIS installer.
I have tried ExecWait and nsExec::Exec, but none of them waits for the real installer, just for the first process to finish.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,我从未见过 ExecWait 失败,但它只会等待子进程,而不是该子进程的子进程。因此链中的每个进程都需要等待其子进程。如果“中间”进程损坏,请尝试 http://nsis.sourceforge.net/ExecWait_and_waiting_for_child_processes_with_Job_Objects
对于 ExecWait ,树看起来像:
您的描述有点不清楚,您能否确认我已经了解了总体思路?
如果您找不到 NSIS 的开关,则意味着您没有 RTFM :)
First off, I have never seen ExecWait fail, but it will only wait for a child process, not the child of that child process. So every process in the chain needs to wait for its child. If the "middle" process is broken, try http://nsis.sourceforge.net/ExecWait_and_waiting_for_child_processes_with_Job_Objects
For ExecWait, the tree would look like:
Your description is a little unclear, can you confirm that I got the general idea?
If you could not find the switches for NSIS it means you did not RTFM :)
发现这个问题是因为我遇到了类似的问题。在我的 NSIS 安装程序中,我下载了一个 Microsoft Visual Studio
exe
文件,并尝试先安装它(以获取一些依赖项dll
文件)。然而,这从来没有奏效:它只是跳过了——我怀疑是因为子进程的问题(也许?MS 安装程序是交互式的,会要求用户接受许可证)。我最终使用 ExecShellWait 来代替:
然后我的安装程序将正确等待第三方安装程序完成,然后再继续。
Found this question because I was having a similar issue. In my NSIS installer, I was downloading a Microsoft Visual Studio
exe
file, and attempting to install it first (to get some dependencydll
files). However, this never worked:It just skipped right over -- I suspect because of the issue with child processes (maybe? The MS installer was interactive and would ask the user to accept a license). I wound up using
ExecShellWait
instead:And then my installer would properly wait for the third-party installer to finish, before moving on.