Skip to content

Fix test execution error handling with stderr output#10

Closed
fumitoh wants to merge 1 commit intomainfrom
claude/fix-test-suite-error-mICkZ
Closed

Fix test execution error handling with stderr output#10
fumitoh wants to merge 1 commit intomainfrom
claude/fix-test-suite-error-mICkZ

Conversation

@fumitoh
Copy link
Member

@fumitoh fumitoh commented Feb 23, 2026

Summary

Modified the test execution logic in the build script to prevent native executable stderr output from triggering PowerShell errors when ErrorActionPreference is set to Stop.

Key Changes

  • Temporarily relax ErrorActionPreference to Continue during test execution
  • Save and restore the previous ErrorActionPreference value to maintain script behavior
  • Allows Boost.Test banner and other stderr output to be captured without causing NativeCommandError

Implementation Details

The issue occurred because when ErrorActionPreference=Stop is active, PowerShell treats stderr output from native commands as errors when combined with 2>&1 redirection. By temporarily setting ErrorActionPreference to Continue during test execution, stderr output is captured as regular output without triggering an exception. The original preference is restored immediately after test execution completes.

https://claude.ai/code/session_013jwxdTatbs5LJz3QyiDmjy

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
@fumitoh fumitoh closed this Feb 24, 2026
@fumitoh fumitoh deleted the claude/fix-test-suite-error-mICkZ branch February 25, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants