Skip to content

Commit

Permalink
Exit Early when facing Syntax Errors, Solves a problem when passing '…
Browse files Browse the repository at this point in the history
…-Run' Argument with 'Compile.ps1' Script - Use 'Out-Null' to follow common project conventions
  • Loading branch information
og-mrk committed Oct 23, 2024
1 parent 974c46c commit 5641623
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Compile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ Write-Progress -Activity "Compiling" -Completed

Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0
try {
$null = Get-Command -Syntax .\winutil.ps1
Get-Command -Syntax .\winutil.ps1 | Out-Null
} catch {
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
Write-Host "$($Error[0])" -ForegroundColor Red
Pop-Location # Restore previous location before exiting...
exit 1
}
Write-Progress -Activity "Validating" -Completed

Expand Down

0 comments on commit 5641623

Please sign in to comment.