PDA

View Full Version : ExecWizardAction return value



tim.wall
03-11-2003, 11:58 AM
The return value is effectively always zero, making it impossible to check the results.

I am calling out to a Developer8 installation (thin wrapper around an MSIExec call). I am hoping to catch the MSI return value and have the calling installer act appropriately (specifically, 3010 means a reboot is required).

So I want to suppress the reboot in the subinstall, but make note of it and set reboot required in the main installer.

ExecWizardAction sets its ProcessExec null when the process finishes (which is also the point at which the return code becomes valid). Unfortunately the returnValue property returns zero if the ProcessExec is null.

I've written a small wrapper to get around the bug, which saves the ProcessExec and saves off the return code before setting the ProcessExec to null.

jdunham07
03-11-2003, 02:00 PM
We are experiencing this problem as well, we use some shell scripts to perform additional installation tasks and return a positive value if they fail which is tested against to stop the installer and notify the user. This worked fine in 4.5x, but now it is broker. Can you post that workaround?

tim.wall
03-11-2003, 02:09 PM
You'll need an extra BeanInfo for it if you want to hide the getReturnValue in the GUI... Alternatively you could patch the code in the $ISMP/samples directory for ExecWizardAction and supersede the one in lib/wizard.jar.

import com.installshield.wizard.*;
import com.installshield.util.*;
import com.installshield.wizard.service.*;
import com.installshield.wizardx.actions.*;

public class ExecWithReturnCode extends ExecWizardAction {
private ProcessExec exec = null;
private int returnValue = 0;

public int getReturnValue() {
return returnValue;
}

/** Hang onto the process exec so that we can get the return code. */
protected ProcessExec createProcessExec() {
returnValue = 0;
return exec = super.createProcessExec();
}

public void execute(WizardBeanEvent event) {
super.execute(event);
returnValue = exec.getExitCode();
exec = null;
}
}