|
|
#1 |
|
Junior Member
|
ErrorLevel Not returning
I am using a custom errorlevel in an installer and it does not appear to be returning as necessary...
PHP Code:
PHP Code:
13.06.2010 12:28:47 *-----------------------------------------------------* 13.06.2010 12:28:47 ### Microsoft Windows Installer 4.5 Installation Starting 13.06.2010 12:28:47 ### Build Verison: 1.0.0.1 13.06.2010 12:28:47 ### Runtime: 6/13/2010 12:28:47 13.06.2010 12:28:47 ### Switches: /S 13.06.2010 12:28:47 *-----------------------------------------------------* 13.06.2010 12:28:47 13.06.2010 12:28:47 Silent Installation has been Requested 13.06.2010 12:28:47 Running Pre-installation Processes 13.06.2010 12:28:47 Detecting the Running Operating System 13.06.2010 12:28:47 OS Detected: Windows 7 64 13.06.2010 12:28:47 Install Error: OS Not Supported 13.06.2010 12:28:47 Cleaning Up Temporary Files ... Please be Patient 13.06.2010 12:28:47 *** Microsoft Windows Installer 4.5 Installation Ended in Error *** Any Ideas are greatly appreciated.. Thanks... |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,813
|
I don't see Quit in there
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Junior Member
|
Do you have to have a Quit in order for it to return the errorlevel... I thought the SetErrorLevel was enough for it to assign the errorlevel for when the installation finishes..? Please correct me if I am wrong.
In a commandline window I do the following... >Set errorlevel=15 ; Set a dummy errorlevel level to validate it changes >Installer.exe /S >echo %errorlevel% ; Still returns 15 for the errorlevel, like the installer NEVER influenses it.. Last edited by Squirre1; 13th June 2010 at 18:15. Reason: Added more info... |
|
|
|
|
|
#4 |
|
Junior Member
|
Just as a FYI, I tested with the Quit in there, and it is STILL not returning the errorlevel correctly. Not sure what is up...
I have also tested different methods of SetErrorLevel for ex. SetErrorLevel "999" SetErrorLevel 999 SetErrorLevel '999' All with the same result, none of them return... Last edited by Squirre1; 13th June 2010 at 19:18. Reason: Just because |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
I believe SetErrorLevel must come immediately before your Quit command (not too sure if GoTo's are allowed), as otherwise NSIS' own code for error level setting upon installer exit may override whatever you set.
Worth a try, at least - our installers have it set immediately before Quit / last command of .onGuiEnd , and work correctly. |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 443
|
It looks like you have masked the true errorlevel by setting a variable with that name before the program started. Remove the "Set ErrorLevel=15" and see if your program returns 999.
|
|
|
|
|
|
#7 |
|
Junior Member
|
That does not mask it, anytime the NSIS installer finishes it should overwrite the previous errorlevel... I have even created small scripts based on some recommendations from the others...
Doesn't Work: Post Execution Errorlevel = 0 PHP Code:
PHP Code:
ExecWait "blah blah blah" $0 SetErrorLevel $0 That works find with no problem... So not quite sure what is up... Im Stumped for the moment... |
|
|
|
|
|
#8 |
|
Junior Member
|
So, a little more into it.. And this is even a little more messed up...
From the scripts in my previous post. If you call it from command line as just seterrorlevel.exe it returns with 0. But if you call it from command line as cmd /c "seterrorlevel.exe" it actually does return the errorlevel of 25... Ugh... Now I am lost, if it is just an interfacing issue or if there is some underlying thing in my NSIS script that is not getting set... |
|
|
|
|
|
#9 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,813
|
To verify error levels, use another nsis script and call ExecWait yourapp.exe $0 and check the register, cmd.exe has many problems with error codes
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Aug 2007
Location: Paris, France
Posts: 301
|
Anders is right..
In cmd.exe, if you want to catch the correct ERRORLEVEL from a non-console app, you must call code: or make a program (like Anders is suggesting) that catch the errorlevel for you My NSIS plug-ins: http://wiz0u.free.fr/prog/nsis.php |
|
|
|
|
|
#11 | |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 443
|
errorlevel is not the same as %errorlevel%
Raymond Chen wrote an article that explains ERRORLEVEL is not the same as %ERRORLEVEL%. That's why I suggested that your "Set errorlevel=0" and "echo %errorlevel% are not displaying the actual errorlevel that the exe returns.
You can also refer to the MS documentation of the "IF" command which says Quote:
|
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|