Qt Installer Framework : Error code 1 is resulting on Warning pop up

87 Views Asked by At

I am trying to use Qt Installer Framework to create an installer of my package. I'm attempting to run a PowerShell script using the following command:

component.addElevatedOperation("Execute", "powershell", ["& \"" + Dir.toNativeSeparator("@TargetDir@/scripts/test.ps1") + "\""], "UNDOEXECUTE", "powershell", ["Remove-LocalUser", "-Name", "test"])

The issue arises when my PowerShell script concludes with an error code of 1. A warning popup then appears with three buttons: "Ignore," "Cancel," "Retry." The popup is accompanied by the text stating, "Execution failed (unexpected exit code: 1): Script path."

The challenge I'm facing is that I want this to be an error popup instead, displaying the actual error description returned by the PowerShell script. For instance, if I use

throw "Hello" 

in my ps1 script, I want my installer to show "Hello" in the error popup.

I haven't found anything in the Qt documentation or forums, which is why I'm reaching out to you.

0

There are 0 best solutions below