Hello Jan,
Well, this is how I think you can achieve what you want. First of all, we will need a wrapper for your EXE (e.g. another EXE, DLL, script file) which will launch your EXE, take its error code and, based on that, returns a specific value and after all that, depending on the return code of the script (which depends on the return code of your EXE), we will fail the installation of the main package or not.
Here is a small PowerShell script example which I hope will makes things more clear:
Code: Select all
$a = Start-Process -FilePath "PathToYourExe" -PassThru -Wait
if ($a.ExitCode -eq 1)
{return 1}
if ($a.ExitCode -eq 0)
{return 0}
As you can notice above, we launch the process of your EXE, wait for it to finish, take its exit code and, based on that, we control the return code of our script. You can easily test the script above using the "notepad.exe" process. Simply replace "PathToYourExe" with "notepad.exe" and test the following cases:
1- close the notepad by pressing the "x" button
2- open
Task Manager -->
"Details" tab --> select "notepad.exe" -->
right click + "End process tree"
In the second case, the script will return 1 (because the notepad.exe was stopped unexpectedly and forcefully --> returning 1 and in the first case, it will return 0 (because the notepad.exe was normally stopped).
After doing all this, you can save the script with the following format (script.ps1) and then use a
"LaunchFile" custom action. Please be aware that the script must return 0 for success or any other value for failure, so please be aware of the if statement you are using.
Hope this helps.
All the best,
Catalin