From ff257c645b9df4a99f042f2e4f63d46d11b4f671 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 3 Mar 2026 20:57:43 -0800 Subject: [PATCH] Spell check: Error when config is invalid --- eng/common/scripts/check-spelling-in-changed-files.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/common/scripts/check-spelling-in-changed-files.ps1 b/eng/common/scripts/check-spelling-in-changed-files.ps1 index aee066a5c0c1..b0d43b210509 100644 --- a/eng/common/scripts/check-spelling-in-changed-files.ps1 +++ b/eng/common/scripts/check-spelling-in-changed-files.ps1 @@ -115,6 +115,7 @@ $spellingErrors = &"$PSScriptRoot/../spelling/Invoke-Cspell.ps1" ` -CspellConfigPath $CspellConfigPath ` -SpellCheckRoot $SpellCheckRoot ` -FileList $changedFilePaths +$cspellExitCode = $LASTEXITCODE if ($spellingErrors) { $errorLoggingFunction = Get-Item 'Function:LogWarning' @@ -130,6 +131,9 @@ if ($spellingErrors) { if ($ExitWithError) { exit 1 } +} elseif ($cspellExitCode -ne 0 -and $ExitWithError) { + LogError "CSpell exited with code $cspellExitCode. This may indicate a configuration error or other failure in the spell checking tool." + exit 1 } else { Write-Host "No spelling errors detected" }