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.
This commit is contained in:
Bruno Lopes 2025-05-09 04:00:38 -03:00
parent 1d5c3cbd43
commit 63d2e1f871
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

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

View file

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