Browse Source

fix(bundler/nsis): only kill processes of current user (#8390)

* fix(bundler/nsis): only kill processes of current user

Co-authored-by: FabianLars-crabnebula <fabianlars@crabnebula.dev>

* change file

---------

Co-authored-by: FabianLars-crabnebula <fabianlars@crabnebula.dev>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
Amr Bashir 1 year ago
parent
commit
5ff9d4592a

+ 5 - 0
.changes/bundler-nsis-process-current-user.md

@@ -0,0 +1,5 @@
+---
+'tauri-bundler': 'patch:bug'
+---
+
+NSIS perUser installers will now only check if the app is running on the current user.

+ 2 - 2
tooling/bundler/src/bundle/windows/nsis.rs

@@ -37,8 +37,8 @@ const NSIS_URL: &str =
 const NSIS_SHA1: &str = "057e83c7d82462ec394af76c87d06733605543d4";
 const NSIS_APPLICATIONID_URL: &str = "https://github.com/tauri-apps/binary-releases/releases/download/nsis-plugins-v0/NSIS-ApplicationID.zip";
 const NSIS_TAURI_UTILS: &str =
-  "https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.2.1/nsis_tauri_utils.dll";
-const NSIS_TAURI_UTILS_SHA1: &str = "53A7CFAEB6A4A9653D6D5FBFF02A3C3B8720130A";
+  "https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.2.2/nsis_tauri_utils.dll";
+const NSIS_TAURI_UTILS_SHA1: &str = "16DF1D1A5B4D5DF3859447279C55BE36D4109DFB";
 
 #[cfg(target_os = "windows")]
 const NSIS_REQUIRED_FILES: &[&str] = &[

+ 10 - 2
tooling/bundler/src/bundle/windows/templates/installer.nsi

@@ -493,13 +493,21 @@ Section WebView2
 SectionEnd
 
 !macro CheckIfAppIsRunning
-  nsis_tauri_utils::FindProcess "${MAINBINARYNAME}.exe"
+  !if "${INSTALLMODE}" == "currentUser"
+    nsis_tauri_utils::FindProcessCurrentUser "${MAINBINARYNAME}.exe"
+  !else
+    nsis_tauri_utils::FindProcess "${MAINBINARYNAME}.exe"
+  !endif
   Pop $R0
   ${If} $R0 = 0
       IfSilent kill 0
       ${IfThen} $PassiveMode != 1 ${|} MessageBox MB_OKCANCEL "$(appRunningOkKill)" IDOK kill IDCANCEL cancel ${|}
       kill:
-        nsis_tauri_utils::KillProcess "${MAINBINARYNAME}.exe"
+        !if "${INSTALLMODE}" == "currentUser"
+          nsis_tauri_utils::KillProcessCurrentUser "${MAINBINARYNAME}.exe"
+        !else
+          nsis_tauri_utils::KillProcess "${MAINBINARYNAME}.exe"
+        !endif
         Pop $R0
         Sleep 500
         ${If} $R0 = 0