Search code examples
wixwindows-installerwix-extension

Wix CAQuietExec write to log on error


I have a custom action that executes a command line tool:

    <CustomAction Id="QtExecUpdateDatabase_Cmd" Property="QtExecUpdateDatabase" Value="&quot;[#DATABASEUPDATER.EXE]&quot;" Execute="immediate" />
<CustomAction Id="QtExecUpdateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" />
<InstallExecuteSequence>
  <Custom Action="QtExecUpdateDatabase_Cmd" After="CostFinalize">NOT REMOVE</Custom>
  <Custom Action="QtExecUpdateDatabase" After="InstallFiles" >NOT REMOVE</Custom>
</InstallExecuteSequence>

In some cases it fails. The msi log looks like this:

SI (s) (98:98) [16:44:06:765]: Executing op: CacheSizeFlush(,)
MSI (s) (98:98) [16:44:06:765]: Executing op: InstallProtectedFiles(AllowUI=1)
MSI (s) (98:98) [16:44:06:765]: Executing op: ActionStart(Name=QtExecUpdateDatabase,,)
Action 16:44:06: QtExecUpdateDatabase. 
MSI (s) (98:98) [16:44:06:781]: Executing op: CustomActionSchedule(Action=QtExecUpdateDatabase,ActionType=1025,Source=BinaryData,Target=CAQuietExec,CustomActionData="D:\Documents and Settings\edugarcia\Configuración local\Datos de programa\Gamesa\HCAOffline\DatabaseUpdater.exe")
MSI (s) (98:B0) [16:44:06:796]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI2D.tmp, Entrypoint: CAQuietExec
MSI (s) (98:EC) [16:44:06:796]: Generating random cookie.
MSI (s) (98:EC) [16:44:06:812]: Created Custom Action Server with PID 3804 (0xEDC).
MSI (s) (98:90) [16:44:06:828]: Running as a service.
MSI (s) (98:90) [16:44:06:843]: Hello, I'm your 32bit Impersonated custom action server.
CAQuietExec:  Error 0x80131700: Command line returned an error.
CAQuietExec:  Error 0x80131700: CAQuietExec Failed
Action ended 16:44:07: InstallFinalize. Return value 3.

Is there any way to log an error message returned by the command line tool?

This command line tool have its own log, but, after fail, all the install process is rolled back, including my preciated log. How can tell wix to do not delete de log of my command line tool?


Solution

  • Here is the solution:

    Any text written by the app (both stdout and stderr) is written to the log, and any non-zero exit code is interpreted as a failure causing CAQuietExec to also return a failure.