This repository has been archived on 2024-09-09 . You can view files and clone it, but cannot push or open issues or pull requests.
b4c5dc548e
20 lines
230 B
PowerShell
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"
|
|||
}
|