Private/Utils.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function WaitForCompletion {
    param (
        [int32] $TaskId,
        [string] $EngineHost,
        [string] $EnginePort
    )
    
    Write-Verbose "Waiting for completion"

    while ($true) {
        $result = Invoke-CheckLongRunningCommand -TaskId $TaskId -EngineHost $EngineHost -EnginePort $EnginePort
        Write-Verbose $result
        if ($result.IsCompleted) {
            $result
            break
        }
        Start-Sleep -Seconds 2
    }
}