From ace37eaf48fca613f692e7a08b182d268fc60555 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 20 Feb 2024 13:56:09 -0500 Subject: [PATCH] fix(windows-installer): uninstall script behavior (#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 --- msi-builder/FinchMSITemplate.wxs | 2 +- msi-builder/uninstall.bat | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/msi-builder/FinchMSITemplate.wxs b/msi-builder/FinchMSITemplate.wxs index 6fb08448f..841056a4a 100644 --- a/msi-builder/FinchMSITemplate.wxs +++ b/msi-builder/FinchMSITemplate.wxs @@ -99,7 +99,7 @@ - + NOT Installed diff --git a/msi-builder/uninstall.bat b/msi-builder/uninstall.bat index 8f5c21a79..42b278102 100644 --- a/msi-builder/uninstall.bat +++ b/msi-builder/uninstall.bat @@ -2,11 +2,11 @@ SET InstallDir=%~1 :: Stop and remove any running instance -finch.exe vm stop -f -finch.exe vm remove -f +finch.exe vm stop -f ^ & +finch.exe vm remove -f ^ & :: Just in case -wsl --terminate lima-finch +wsl --terminate lima-finch ^ & wsl --unregister lima-finch :: Delete files and directories if they exist