Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): Windows updates no longer fail when one app process is left running #25831

Openjuliusmarmingewants to merge 5 commits intomain fromrefs/pull/25831/headopened View on GitHub

Showing 2 changed files with 29 additions and 9 deletions.

x
0 of 2 viewed, 2 left
29 additions and 9 deletionspatches/app-builder-lib@26.16.1.patchModified
View file
@@ -14,11 +14,31 @@
await nsisUtil_1.UninstallerReader.exec(installerPath, uninstallerPath);
diff --git a/templates/nsis/include/allowOnlyOneInstallerInstance.nsh b/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
+index 7d08e55f5ddf70e51ebd965803d001561bca6d71..4977fcfc35ba32e039f1211ca0ed05ccd20f38f1 100644
--- a/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
+++ b/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
-@@ -103,6 +103,9 @@
- !macroend
-​
+@@ -63,7 +63,8 @@
+
+ !macro FIND_PROCESS _FILE _RETURN
+ ${if} $IsPowerShellAvailable == 0
+- nsExec::Exec `"$PowerShellPath" -NoProfile -NonInteractive -C "if ((Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')}).Count -gt 0) { exit 0 } else { exit 1 }"`
++ # @() keeps .Count defined for one process on PowerShell 5.1 (electron-builder#10454); skip our own PID
++ nsExec::Exec `"$PowerShellPath" -NoProfile -NonInteractive -C "if (@(Get-CimInstance -ClassName Win32_Process | ? {$$_.ProcessId -ne $pid -and $$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')}).Count -gt 0) { exit 0 } else { exit 1 }"`
+ Pop ${_RETURN}
+ ${else}
+ !ifdef INSTALL_MODE_PER_ALL_USERS
+@@ -91,7 +92,7 @@
+ ${endIf}
+
+ ${if} $IsPowerShellAvailable == 0
+- nsExec::Exec `"$PowerShellPath" -NoProfile -NonInteractive -C "Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')} | % { Stop-Process -Id $$_.ProcessId $0 }"`
++ nsExec::Exec `"$PowerShellPath" -NoProfile -NonInteractive -C "Get-CimInstance -ClassName Win32_Process | ? {$$_.ProcessId -ne $pid -and $$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')} | % { Stop-Process -Id $$_.ProcessId $0 }"`
+ ${else}
+ !ifdef INSTALL_MODE_PER_ALL_USERS
+ nsExec::Exec `taskkill /IM "${_FILE}" /FI "PID ne $pid"`
+@@ -103,6 +104,9 @@