From 63d2e1f87121f329c5756afba4ec05f0f13784f0 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Fri, 9 May 2025 04:00:38 -0300 Subject: [PATCH] build/windows: Set timeout for Restore Point creation See: #13874 The process is managed by WMI so we need to prevent stuckness that can happen in rare scenarios. --- build/windows/installer/base_gimp3264.iss | 2 +- build/windows/installer/util_uninst.isi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/windows/installer/base_gimp3264.iss b/build/windows/installer/base_gimp3264.iss index 00270c5a0b..cb0315c39e 100644 --- a/build/windows/installer/base_gimp3264.iss +++ b/build/windows/installer/base_gimp3264.iss @@ -1173,7 +1173,7 @@ var ResultCode: Integer; begin StatusLabel(CustomMessage('CreatingRestorePoint'),''); - if not ShellExec('RunAs', 'powershell', ExpandConstant('Checkpoint-Computer -Description "GIMP_{#CUSTOM_GIMP_VERSION}_install" -RestorePointType APPLICATION_INSTALL'), + if not ShellExec('RunAs', 'powershell', '-Command "$job = Start-Job -ScriptBlock { Checkpoint-Computer -Description "GIMP_' + ExpandConstant('{#CUSTOM_GIMP_VERSION}') + '_install" -RestorePointType APPLICATION_INSTALL }; Wait-Job $job -Timeout 24; if ($job.State -eq \"Running\") { Stop-Job $job -Confirm:$false }; Receive-Job $job"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then begin DebugMsg('RestorePoint','Failed to create restore point. Error code: ' + IntToStr(ResultCode)); diff --git a/build/windows/installer/util_uninst.isi b/build/windows/installer/util_uninst.isi index 88758516be..0ffbda44d6 100644 --- a/build/windows/installer/util_uninst.isi +++ b/build/windows/installer/util_uninst.isi @@ -266,7 +266,7 @@ var ResultCode: Integer; begin UninstallProgressForm.StatusLabel.Caption := CustomMessage('CreatingRestorePoint'); - if not ShellExec('RunAs', 'powershell', ExpandConstant('Checkpoint-Computer -Description "GIMP_{#CUSTOM_GIMP_VERSION}_uninstall" -RestorePointType APPLICATION_UNINSTALL'), + if not ShellExec('RunAs', 'powershell', '-Command "$job = Start-Job -ScriptBlock { Checkpoint-Computer -Description "GIMP_' + ExpandConstant('{#CUSTOM_GIMP_VERSION}') + '_uninstall" -RestorePointType APPLICATION_UNINSTALL }; Wait-Job $job -Timeout 24; if ($job.State -eq \"Running\") { Stop-Job $job -Confirm:$false }; Receive-Job $job"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then begin DebugMsg('RestorePointU','Failed to create restore point. Error code: ' + IntToStr(ResultCode));