diff --git a/test/sanity/pslint/pslint.ps1 b/test/sanity/pslint/pslint.ps1 index 8f7beab294..ac8e65771e 100755 --- a/test/sanity/pslint/pslint.ps1 +++ b/test/sanity/pslint/pslint.ps1 @@ -4,11 +4,25 @@ Set-StrictMode -Version 2.0 $ErrorActionPreference = "Stop" +$WarningPreference = "Stop" $Results = @() ForEach ($Path in $Args) { - $Results += Invoke-ScriptAnalyzer -Path $Path -Setting $PSScriptRoot/settings.psd1 + $Retries = 3 + + Do { + Try { + $Results += Invoke-ScriptAnalyzer -Path $Path -Setting $PSScriptRoot/settings.psd1 3> $null + $Retries = 0 + } + Catch { + If (--$Retries -le 0) { + Throw + } + } + } + Until ($Retries -le 0) } ConvertTo-Json -InputObject $Results