Skip to content

Commit 888e23f

Browse files
committed
Detect and prompt for shutdown of Gridcoin wallet during install for Windows
This commit introduces the use of ExecWait in combination with tasklist and find to detect a running Gridcoin wallet, either GUI or daemon, and prompt to shut it down before installation proceeds.
1 parent 2121748 commit 888e23f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

share/setup.nsi.in

+12
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ Function .onInit
168168
Abort
169169
${EndIf}
170170
!endif
171+
loop:
172+
ExpandEnvStrings $1 "%COMSPEC%"
173+
ExecWait '$1 /C "$\"$SYSDIR\tasklist.exe$\" /NH /FI $\"IMAGENAME eq @GRIDCOIN_GUI_NAME@@EXEEXT@$\" | $\"$SYSDIR\find.exe$\" /I $\"@GRIDCOIN_GUI_NAME@@EXEEXT@$\""' $0
174+
StrCmp $0 0 0 notRunning_gui
175+
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION 'The Gridcoin wallet (@GRIDCOIN_GUI_NAME@@EXEEXT@) is running. Please close before continuing.' IDOK loop IDCANCEL end
176+
notRunning_gui:
177+
ExecWait '$1 /C "$\"$SYSDIR\tasklist.exe$\" /NH /FI $\"IMAGENAME eq @GRIDCOIN_DAEMON_NAME@@EXEEXT@$\" | $\"$SYSDIR\find.exe$\" /I $\"@GRIDCOIN_DAEMON_NAME@@EXEEXT@$\""' $0
178+
StrCmp $0 0 0 notRunning_daemon
179+
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION 'The Gridcoin wallet daemon (@GRIDCOIN_DAEMON_NAME@@EXEEXT@) is running. Please close before continuing.' IDOK loop IDCANCEL end
180+
notRunning_daemon:
171181
; Check for HKCU Path registry and prompt for uninstallation if found
172182
ReadRegStr $0 HKCU "${REGKEY}" "Path"
173183
${IfThen} $0 == "" ${|} Return ${|}
@@ -184,6 +194,8 @@ Function .onInit
184194
${EndIf}
185195
ExecWait "$1 _?=$0" $0
186196
${IfThen} $0 != 0 ${|} Abort ${|}
197+
end:
198+
Abort
187199
FunctionEnd
188200

189201
# Uninstaller functions

0 commit comments

Comments
 (0)