diff --git a/packaging/windows/farmcontrol.nsi b/packaging/windows/farmcontrol.nsi index 37586c2..642a26a 100644 --- a/packaging/windows/farmcontrol.nsi +++ b/packaging/windows/farmcontrol.nsi @@ -115,7 +115,12 @@ Section "Farm Control" SecMain WriteUninstaller "$INSTDIR\Uninstall.exe" - !insertmacro progressSuccess + ; For in-app updates (/RESTARTFC) the success signal is emitted from + ; restartFarmControlAfterUpdate, right before the install directory swap, + ; so the running app quits while this installer stays alive. + ${If} $RestartAfterInstall != "1" + !insertmacro progressSuccess + ${EndIf} SectionEnd Section "Uninstall" diff --git a/packaging/windows/installer.nsh b/packaging/windows/installer.nsh index 940f557..14b5255 100644 --- a/packaging/windows/installer.nsh +++ b/packaging/windows/installer.nsh @@ -304,8 +304,14 @@ Function restartFarmControlAfterUpdate Return ${EndIf} + ; All files are copied and we are about to rename the install directory. + ; Emit the success line (matched by isWindowsInstallSuccessful in + ; winappupdate.js) so the app knows to quit and restart; this installer + ; stays alive to swap the folders and relaunch Farm Control. + !insertmacro progressSuccess + !insertmacro progressStatus "Waiting for Farm Control to close..." - Sleep 1000 + Sleep 1500 restart_wait_loop: ExecWait 'cmd.exe /c tasklist /FI "IMAGENAME eq FarmControl.exe" 2>nul | find /I "FarmControl.exe"' $R0