Files
vscode/build/azure-pipelines/win32/retry.ps1
João Moreno bafc05ff0a fix retry
2020-11-27 11:30:34 +01:00

20 lines
230 B
PowerShell

function Retry
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd
)
$retry = 0
while ($retry++ -lt 3) {
try {
& $cmd
return
} catch {
# noop
}
}
throw "Max retries reached"
}