Skip to content

Commit ace37ea

Browse files
authored
fix(windows-installer): uninstall script behavior (runfinch#822)
Issue #, if available: - After my recent changes to the uninstall script (which were aimed at making sure Lima was not running and the WSL2 instance was stopped), I tested the new installer, and it still had weird behavior. I noticed that the script would exit immediately if the Lima stop command failed, so I added the `&` separators. After that, I noticed that the WSL commands would fail immediately. This was because the commands were being executed as a Local install user, instead of the target user. Changing `Impersonate` to `yes` should resolve that issue ([docs](https://wixtoolset.org/docs/v3/xsd/wix/customaction/)). _Description of changes:_ - Ensure that all commands execute by separating them with & instead of letting failures stop the script - Ensure script runs in the user's context by setting `Impersonate` to `yes` *Testing done:* - Local testing - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Justin Alvarez <[email protected]>
1 parent 6ca0f7f commit ace37ea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: msi-builder/FinchMSITemplate.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<ComponentRef Id="Component_Roofts" />
100100
</ComponentGroup>
101101
<CustomAction Id="RunPostInstallScript" FileKey="postinstall_bat" ExeCommand="&quot;[INSTALLFOLDER]&quot;" Return="check" Execute="deferred" Impersonate="no" />
102-
<CustomAction Id="RunUninstallScript" FileKey="uninstall_bat" ExeCommand="&quot;[INSTALLFOLDER]&quot;" Execute="deferred" Return="ignore" Impersonate="no" />
102+
<CustomAction Id="RunUninstallScript" FileKey="uninstall_bat" ExeCommand="&quot;[INSTALLFOLDER]&quot;" Execute="deferred" Return="ignore" Impersonate="yes" />
103103
<InstallExecuteSequence>
104104
<RemoveExistingProducts After="InstallInitialize" />
105105
<Custom Action="RunPostInstallScript" After="InstallFiles">NOT Installed</Custom>

Diff for: msi-builder/uninstall.bat

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
SET InstallDir=%~1
33

44
:: Stop and remove any running instance
5-
finch.exe vm stop -f
6-
finch.exe vm remove -f
5+
finch.exe vm stop -f ^ &
6+
finch.exe vm remove -f ^ &
77

88
:: Just in case
9-
wsl --terminate lima-finch
9+
wsl --terminate lima-finch ^ &
1010
wsl --unregister lima-finch
1111

1212
:: Delete files and directories if they exist

0 commit comments

Comments
 (0)