Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
3.2.0
-
None
Description
I am calling the maintenance tool from the installer to make an automatic uninstallation and I need to add a check loop after the installer.execute function call to be sure that the uninstallation is really completed.
The installer.execute function is synchrone according to the documentation. So I shouldn't have to add a wait.
Here is my code:
Component.prototype.componentPerformInstallationPageEntered = function() { var dir = installer.value("TargetDir"); if (installer.fileExists(dir)) { if (systemInfo.productType === "windows" && installer.fileExists(dir + "/Map Editor.exe")) { installer.execute("\"" + dir + "/maintenancetool.exe\"", "--script=" + dir + "/scripts/auto_uninstall.js"); } else if (installer.fileExists(dir + "/Map Editor")) { installer.execute("sh", ["-c" , "\"" + dir + "/maintenancetool\" --script=\"" + dir + "/scripts/auto_uninstall.js\""]); } while (installer.fileExists(dir)) delay(50); } }
Code of the auto_uninstall.js script:
function Controller() { installer.gainAdminRights(); gui.clickButton(buttons.NextButton); gui.clickButton(buttons.CommitButton); installer.uninstallationFinished.connect(this, this.uninstallationFinished); } Controller.prototype.uninstallationFinished = function() { gui.clickButton(buttons.NextButton); } Controller.prototype.FinishedPageCallback = function() { gui.clickButton(buttons.FinishButton); }
If I don't put the wait the installation can be corrupted.
I think that this issue is mainly on Windows, but I am not sure for other OS.