vscode/build/azure-pipelines/win32/retry.ps1
mxwj 018ff30de3
Some checks failed
Monaco Editor checks / Monaco Editor checks (push) Has been cancelled
Initial commit
2024-11-15 14:29:18 +08:00

20 lines
230 B
PowerShell

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"
}