[Windows] Wait on a wall-clock 60 s deadline instead of a loop counter

This commit is contained in:
Lukas Brübach 2026-09-21 18:46:06 +02:00 committed by GitHub
parent 0f45ad9b46
commit 20229825f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -279,16 +279,19 @@ Function WaitForAppToClose
; ask the application to close gracefully (WM_CLOSE), then wait for it to exit
DetailPrint "Closing $R1 ..."
Call CloseMatchingApps
StrCpy $R8 0
; wall-clock deadline: each poll has to spawn a fresh powershell.exe, so
; a bare loop counter would not bound the real wait time to 60 s.
${GetTickCount} $R8
ck_wait_loop:
Sleep 500
IntOp $R8 $R8 + 1
Call IsAppRunning
${If} $R0 = 0
DetailPrint "$R1 closed."
Return
${EndIf}
${If} $R8 < 60
${GetTickCount} $R9
IntOp $R9 $R9 - $R8
${If} $R9 < 60000
Goto ck_wait_loop
${EndIf}
; give up waiting, force close
@ -366,16 +369,19 @@ Function un.WaitForAppToClose
${If} ${Silent}
DetailPrint "Closing $R1 ..."
Call un.CloseMatchingApps
StrCpy $R8 0
; wall-clock deadline: each poll has to spawn a fresh powershell.exe, so
; a bare loop counter would not bound the real wait time to 60 s.
${GetTickCount} $R8
un_ck_wait_loop:
Sleep 500
IntOp $R8 $R8 + 1
Call un.IsAppRunning
${If} $R0 = 0
DetailPrint "$R1 closed."
Return
${EndIf}
${If} $R8 < 60
${GetTickCount} $R9
IntOp $R9 $R9 - $R8
${If} $R9 < 60000
Goto un_ck_wait_loop
${EndIf}
DetailPrint "Force closing $R1 ..."