Refine Windows installer update process to handle in-app updates more effectively
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

- Adjusted the success signal emission in the `restartFarmControlAfterUpdate` function to ensure the application quits and restarts correctly during in-app updates.
- Added a conditional check to control the progress success indication based on the update state, improving the user experience during installations.
This commit is contained in:
Tom Butcher 2026-08-09 00:32:52 +01:00
parent de2c93d82f
commit 6bf8648e1f
2 changed files with 13 additions and 2 deletions

View File

@ -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"

View File

@ -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