Old 3rd January 2016, 10:22   #1
Zussini
Junior Member
 
Join Date: Apr 2015
Posts: 2
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
Zussini is offline   Reply With Quote
Old 3rd January 2016, 11:13   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 923
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.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 4th January 2016, 20:45   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,504
PHP Code:
!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 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump