mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
make sure we continue with retry loop when we get an error (#7550)
Improve logging
This commit is contained in:
+6
-3
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user