Skip to content
⌘ NSIS Forum Archive

ExecWait exit code return error when embedding installers

3 posts

Zussini#

ExecWait exit code return error when embedding installers

Hello I have a simple problem. I do not undestand the Error in documentation of ExecWait.
Here is a part of the documenatation text:
If an output variable is specified, ExecWait sets the variable with the exit code (and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined).
So how can I reproduce the error when I embed another installer. I tried on many ways, and I could not do it. I know that in my example the error flag wont be set as far as exit code is kept in $0 variable, but at the same time, there is a sentence above: "(and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined)" so my question is how can I get such an error that my $0 variable will be undefined and I errorflag will return error ?

ClearErrors
ExecWait '"$EXEDIR\Windows\Server\test.exe"' $0
IfErrors 0 next1
MessageBox MB_OK "The installation has finished unexpectedly. Installation of Server component will be aborted."
Quit
next1:
MessageBox MB_OK $0
JasonFriday13#
That depends on the type of installer you are running. Generally ExecWait is used for console applications.

For anything with a GUI, usually you have to pass some flags with the command so that the process being launched runs in automatic mode, usually there is a silent flag you can add to do this.

The error being talked about here is if the ExecWait command fails, it's not about the process being run. You should be checking $0 for the processes return value to see if it succeeded or not.
Anders#
!include LogicLib.nsh
Section 
ClearErrors
ExecWait '"$windir\doesNotExist.exe"' $0
${If} ${Errors}
    MessageBox MB_ICONSTOP "Error, program does not exist? Not a valid .exe? No access? Machine shutting down?"
${EndIF}
SectionEnd