diff --git a/PwshSpectreConsole.Docs/src/powershell/UpdateDocs.ps1 b/PwshSpectreConsole.Docs/src/powershell/UpdateDocs.ps1 index 5f87a026..ae9f5067 100644 --- a/PwshSpectreConsole.Docs/src/powershell/UpdateDocs.ps1 +++ b/PwshSpectreConsole.Docs/src/powershell/UpdateDocs.ps1 @@ -155,12 +155,9 @@ foreach ($doc in $docs) { Write-Host "Modified sample:" Write-Host -ForegroundColor DarkGray $code if($code -like "*Write-Error*") { - $ErrorActionPreference = "SilentlyContinue" - Invoke-Expression $code - $ErrorActionPreference = "Stop" - } else { - Invoke-Expression $code + $code = $code -replace "Write-Error", "Write-Host" } + Invoke-Expression $code $recording = Stop-SpectreRecording -Title "Example $([int]$example++)" $castName = ($doc.Name -replace '.md$', '' -replace '-', '').ToLower() + "Example$example"