Refine Windows installer process for improved shutdown handling and error reporting
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Reduced the wait time for graceful shutdown of the Farm Control application from two minutes to two seconds, enhancing responsiveness during updates. - Implemented additional checks to confirm the termination of the Farm Control process, providing clearer error messages if the process fails to stop. - Adjusted the loop for verifying process termination to improve efficiency and reduce unnecessary delays.
This commit is contained in:
parent
28295f5912
commit
557c334aa0
@ -345,20 +345,31 @@ Function restartFarmControlAfterUpdate
|
||||
; builds can keep bun/renderer processes alive after the launcher exits.
|
||||
System::Call 'kernel32::OpenProcess(i 0x00100000, i 0, i $UpdateParentPid) p .r0'
|
||||
${If} $0 != 0
|
||||
; Allow two minutes for a graceful CEF shutdown.
|
||||
System::Call 'kernel32::WaitForSingleObject(p r0, i 120000) i .r1'
|
||||
System::Call 'kernel32::CloseHandle(p r0)'
|
||||
|
||||
; Allow two seconds for a graceful exit, then terminate the process tree.
|
||||
System::Call 'kernel32::WaitForSingleObject(p r0, i 2000) i .r1'
|
||||
${If} $1 == 258
|
||||
!insertmacro progressStatus "Farm Control is taking too long to close; forcing shutdown..."
|
||||
!insertmacro progressStatus "Stopping Farm Control..."
|
||||
DetailPrint "Farm Control process $UpdateParentPid did not exit; terminating its process tree..."
|
||||
ExecWait 'taskkill /F /T /PID $UpdateParentPid' $R0
|
||||
|
||||
; Verify that taskkill actually terminated the process before swapping.
|
||||
System::Call 'kernel32::WaitForSingleObject(p r0, i 10000) i .r1'
|
||||
${EndIf}
|
||||
|
||||
System::Call 'kernel32::CloseHandle(p r0)'
|
||||
${If} $1 != 0
|
||||
!insertmacro progressFailure "Could not stop the running Farm Control process."
|
||||
Abort
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else}
|
||||
; Compatibility fallback for manually launched older installers.
|
||||
Sleep 2000
|
||||
!insertmacro quitFarmControl
|
||||
|
||||
; Confirm both known launcher names have stopped before continuing.
|
||||
StrCpy $R7 0
|
||||
restart_wait_loop:
|
||||
restart_verify_loop:
|
||||
ExecWait 'cmd.exe /c tasklist /FI "IMAGENAME eq FarmControl.exe" 2>nul | find /I "FarmControl.exe"' $R0
|
||||
${If} $R0 != 0
|
||||
ExecWait 'cmd.exe /c tasklist /FI "IMAGENAME eq launcher.exe" 2>nul | find /I "launcher.exe"' $R0
|
||||
@ -368,13 +379,13 @@ Function restartFarmControlAfterUpdate
|
||||
${EndIf}
|
||||
|
||||
IntOp $R7 $R7 + 1
|
||||
${If} $R7 < 80
|
||||
Sleep 1500
|
||||
Goto restart_wait_loop
|
||||
${If} $R7 < 20
|
||||
Sleep 500
|
||||
Goto restart_verify_loop
|
||||
${EndIf}
|
||||
|
||||
!insertmacro progressStatus "Farm Control is taking too long to close; forcing shutdown..."
|
||||
!insertmacro quitFarmControl
|
||||
!insertmacro progressFailure "Could not stop the running Farm Control process."
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
restart_wait_done:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user