make sure we continue with retry loop when we get an error (#7550)

Improve logging
This commit is contained in:
Travis Plunk 2018-08-16 17:24:41 -07:00 committed by GitHub
parent 4866b5f326
commit bfd46b1a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -694,25 +694,28 @@ function Restore-PSPackage
}
$ProjectDirs | ForEach-Object {
Write-Log "Run dotnet restore $_ $RestoreArguments"
$project = $_
Write-Log "Run dotnet restore $project $RestoreArguments"
$retryCount = 0
$maxTries = 5
while($retryCount -lt $maxTries)
{
try
{
Start-NativeExecution { dotnet restore $_ $RestoreArguments }
Start-NativeExecution { dotnet restore $project $RestoreArguments }
}
catch
{
Write-Log "Failed to restore $_, retrying..."
Write-Log "Failed to restore $project, retrying..."
$retryCount++
if($retryCount -ge $maxTries)
{
throw
}
continue
}
Write-Log "Done restoring $project"
break
}
}