mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-24 10:23:02 -07:00
[Windows] Fix exit-code detection in the uninstaller process check
This commit is contained in:
parent
8a6b4796cd
commit
410e59b507
1 changed files with 9 additions and 4 deletions
|
|
@ -308,12 +308,17 @@ FunctionEnd
|
||||||
; Uninstaller copies of the same routines (the uninstaller gets its own
|
; Uninstaller copies of the same routines (the uninstaller gets its own
|
||||||
; function set compiled in, it cannot call the installer functions).
|
; function set compiled in, it cannot call the installer functions).
|
||||||
Function un.IsAppRunning
|
Function un.IsAppRunning
|
||||||
nsExec::ExecToLog 'powershell -NoProfile -Command "Get-Process -Name $\'$R2$\' -ErrorAction SilentlyContinue | Where-Object { $$_.Path -like $\'$INSTDIR\*$\' } | Select-Object -First 1"'
|
; Exit the process explicitly so nsExec's pop reflects whether a matching
|
||||||
|
; process was found: powershell.exe exits 0 whether or not the pipeline
|
||||||
|
; produced objects. Any other result (exit 1, or nsExec's "error" string
|
||||||
|
; when powershell itself cannot be started) is treated as "running" so the
|
||||||
|
; lock guard fails closed.
|
||||||
|
nsExec::ExecToLog 'powershell -NoProfile -Command "if (Get-Process -Name $\'$R2$\' -ErrorAction SilentlyContinue | Where-Object { $$_.Path -like $\'$INSTDIR\*$\' } | Select-Object -First 1) { exit 1 } else { exit 0 }"'
|
||||||
Pop $R0
|
Pop $R0
|
||||||
${If} $R0 = 0
|
${If} $R0 == "0"
|
||||||
StrCpy $R0 1
|
|
||||||
${Else}
|
|
||||||
StrCpy $R0 0
|
StrCpy $R0 0
|
||||||
|
${Else}
|
||||||
|
StrCpy $R0 1
|
||||||
${EndIf}
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue