Skip to content

Commit 3acf909

Browse files
author
Paul D.Smith
committed
LASTERROREXIT does not catch Invoke-Analyzer errors.
1 parent aa5bd93 commit 3acf909

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/CheckPowershellCompliance.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ function Confirm-Compliance {
9191
}
9292

9393
# Recursively find all *.ps1 files and run Invoke-ScriptAnalyzer against them.
94-
Get-ChildItem -Path . -Recurse -Include '*.ps1' | Invoke-ScriptAnalyzer -Settings $settings
95-
if ($LastExitCode -ne 0) {
94+
$problems = $(Get-ChildItem -Path ./custom -Recurse -Include '*.ps1' | Invoke-ScriptAnalyzer -Settings $settings)
95+
if ("" -ne $problems) {
96+
Write-Output $problems
9697
Write-Error 'ScriptAnalyzer found (possibly back-compatibility) issues.'
9798
exit 5
9899
}

0 commit comments

Comments
 (0)