From 20229825f09d4c124a5601426d72f5589b43730d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 21 Sep 2026 18:46:06 +0200 Subject: [PATCH] [Windows] Wait on a wall-clock 60 s deadline instead of a loop counter --- cmake/NSIS.template.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 51ed9d792..d044cfd81 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -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 ..."