Catching Command-line build exception - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Catching Command-line build exception

Hi,
During a command-line build, my script checks the exit code of the installer. For some reason, even when an exception is thrown (missing file), the exit code is still 0, so my script misses the error.

Any ideas? I can't find any mention of exit codes in the help file.

thank you,
Dennis
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Catching Command-line build exception

Hi Dennis,

Advanced Installer is returning a non-zero value if an exception has occurred.
You may want to check the following article on using errorlevel to determine the return code of an application:
http://blogs.msdn.com/oldnewthing/archi ... 65755.aspx

Let me know if this helped.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Re: Catching Command-line build exception

Hi Gabriel,
I'm aware of errorlevel.
I finally figured out the problem.

I'm calling AdvancedInstaller.com from a powershell script:

Code: Select all

		
&$ADVINSTALLER\AdvancedInstaller.com /execute .\InstallerStaging\$TargetChannel\XYZ.aip .\InstallerStaging\$TargetChannel\AICommands.txt -nofail | Out-File -Append -filepath BuildLog.log 
if ($LASTEXITCODE -ne 0)
{
	ErrorHandle($CurrentAction)
}
An exception occurs, and $LASTEXITCODE is 0

The issue is the -nofail option, which makes sense to me. Removing -nofail resolves the issue.
I put all this in the reply in case others have this problem in the future.

Dennis

Return to “Common Problems”