From a5c6e4063ae18dc59281e92f0f8ae2330214d046 Mon Sep 17 00:00:00 2001 From: Hu Shuai Date: Mon, 26 Jul 2021 17:25:17 +0800 Subject: [PATCH] fix(nsis): should close app when `Silent` and `ONE_CLICK` --- .../templates/nsis/uninstaller.nsh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/app-builder-lib/templates/nsis/uninstaller.nsh b/packages/app-builder-lib/templates/nsis/uninstaller.nsh index 354007f46e..41089a358d 100644 --- a/packages/app-builder-lib/templates/nsis/uninstaller.nsh +++ b/packages/app-builder-lib/templates/nsis/uninstaller.nsh @@ -1,13 +1,19 @@ +Function un.checkAppRunning + !insertmacro CHECK_APP_RUNNING +FunctionEnd + Function un.onInit !insertmacro check64BitAndSetRegView - ${IfNot} ${Silent} + ${If} ${Silent} + call un.checkAppRunning + ${else} !ifdef ONE_CLICK MessageBox MB_OKCANCEL "$(areYouSureToUninstall)" IDOK +2 Quit # one-click installer executes uninstall section in the silent mode, but we must show message dialog if silent mode was not explicitly set by user (using /S flag) - !insertmacro CHECK_APP_RUNNING + call un.checkAppRunning SetSilent silent !endif ${endIf} @@ -20,9 +26,11 @@ Function un.onInit FunctionEnd Section "un.install" + # for assisted installer we check it here to show progress !ifndef ONE_CLICK - # for assisted installer we check it here to show progress - !insertmacro CHECK_APP_RUNNING + ${IfNot} ${Silent} + call un.checkAppRunning + ${endIf} !endif !insertmacro setLinkVars