From 65f7e5a4351583656e44b243595f9bed2a813183 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Feb 2026 13:27:02 +0000 Subject: [PATCH] Fix NativeCommandError when running test suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Temporarily set $ErrorActionPreference to "Continue" around the test suite execution. With the global "Stop" preference, any stderr output from the native executable (e.g. Boost.Test banner/progress text) was being wrapped as a PowerShell ErrorRecord and immediately triggering a terminating NativeCommandError — even when the test suite passes. The exit code is already checked explicitly via $LASTEXITCODE, so relaxing the preference for this one invocation is safe. https://claude.ai/code/session_013jwxdTatbs5LJz3QyiDmjy --- scripts/Build-QuantLibDLL.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Build-QuantLibDLL.ps1 b/scripts/Build-QuantLibDLL.ps1 index c6247da..374905f 100644 --- a/scripts/Build-QuantLibDLL.ps1 +++ b/scripts/Build-QuantLibDLL.ps1 @@ -328,8 +328,14 @@ if ($RunTests) { $env:PATH = "$DllDir;$env:PATH" Write-Host " DLL directory added to PATH: $DllDir" + # Temporarily relax ErrorActionPreference so that stderr output from the + # native executable (e.g. Boost.Test banner) does not trigger a + # NativeCommandError when combined with 2>&1 and $ErrorActionPreference=Stop. + $prevEAP = $ErrorActionPreference + $ErrorActionPreference = "Continue" $testOutput = & $TestExePath.FullName 2>&1 | Out-String $testExitCode = $LASTEXITCODE + $ErrorActionPreference = $prevEAP Write-Host $testOutput if ($testExitCode -ne 0) {