Skip to content

Fix: Handle non-zero exit codes and capture stdout in fromPathString - #181

Open
Nightwing-007 wants to merge 3 commits into
Pushpavel:mainfrom
Nightwing-007:fix/silent-build-failure-stdout
Open

Fix: Handle non-zero exit codes and capture stdout in fromPathString#181
Nightwing-007 wants to merge 3 commits into
Pushpavel:mainfrom
Nightwing-007:fix/silent-build-failure-stdout

Conversation

@Nightwing-007

Copy link
Copy Markdown

Replaces PR #179.

Description

This PR fixes a silent build failure bug where fromPathString was not checking the build's exit code.

Previously, if a compiler (such as MSVC) failed but wrote its diagnostic errors to stdout instead of stderr, ProcessRunner would not throw an exception. The system treated the build as successful and would attempt to run a missing or stale binary.

Changes Made

  • Added an explicit check for result.exitCode != 0 inside TwoStepProcessFactory.kt.
  • Captured the compiler's stdout output and folded it directly into the ProcessRunnerErr.RuntimeErr message.
  • This ensures that the user is actually presented with the compiler's diagnostics rather than a generic PATH error, and it future-proofs the build step in case we later decide to ignore stderr warnings.

Previously, build commands running through fromPathString ignored the exit code. If a compiler (like MSVC) output its diagnostics to stdout instead of stderr, the build was treated as successful. This fix explicitly checks the exit code and folds the captured stdout into the ProcessRunnerErr.RuntimeErr to display the actual compiler errors to the user.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...hpavel/autocp/tester/base/TwoStepProcessFactory.kt 0.00% 7 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Files with missing lines Coverage Δ
...hpavel/autocp/tester/base/TwoStepProcessFactory.kt 0.00% <0.00%> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Added Mockito dependency to build.gradle.kts

- Created TwoStepProcessFactoryTest to verify runtime error generation and stdout capture for both empty and populated compiler outputs.

- This resolves the 0% patch coverage reported by Codecov.
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