vscode/build/azure-pipelines/win32/retry.ps1

20 lines
230 B
PowerShell
Raw Normal View History

2024-11-15 06:29:18 +00:00
function Retry
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd
)
$retry = 0
while ($retry++ -lt 5) {
try {
& $cmd
return
} catch {
# noop
}
}
throw "Max retries reached"
}