Skip to content

Commit

Permalink
fix(bundler/nsis): only kill processes of current user (#8390)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Dec 13, 2023
1 parent 30adc8d commit 5ff9d45
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/bundler-nsis-process-current-user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

NSIS perUser installers will now only check if the app is running on the current user.
4 changes: 2 additions & 2 deletions tooling/bundler/src/bundle/windows/nsis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] = &[
Expand Down
12 changes: 10 additions & 2 deletions tooling/bundler/src/bundle/windows/templates/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ff9d45

Please sign in to comment.