Skip to content

Commit bfd46b1

Browse files
authored
make sure we continue with retry loop when we get an error (PowerShell#7550)
Improve logging
1 parent 4866b5f commit bfd46b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build.psm1

+6-3
Original file line numberDiff line numberDiff line change
@@ -694,25 +694,28 @@ function Restore-PSPackage
694694
}
695695

696696
$ProjectDirs | ForEach-Object {
697-
Write-Log "Run dotnet restore $_ $RestoreArguments"
697+
$project = $_
698+
Write-Log "Run dotnet restore $project $RestoreArguments"
698699
$retryCount = 0
699700
$maxTries = 5
700701
while($retryCount -lt $maxTries)
701702
{
702703
try
703704
{
704-
Start-NativeExecution { dotnet restore $_ $RestoreArguments }
705+
Start-NativeExecution { dotnet restore $project $RestoreArguments }
705706
}
706707
catch
707708
{
708-
Write-Log "Failed to restore $_, retrying..."
709+
Write-Log "Failed to restore $project, retrying..."
709710
$retryCount++
710711
if($retryCount -ge $maxTries)
711712
{
712713
throw
713714
}
715+
continue
714716
}
715717

718+
Write-Log "Done restoring $project"
716719
break
717720
}
718721
}

0 commit comments

Comments
 (0)