Skip to content

Fix run_json failure handling for nonzero exits - #5

Open
abhinavgautam01 wants to merge 1 commit into
Maxed-OSS:mainfrom
abhinavgautam01:fix/run-json-nonzero-exit
Open

Fix run_json failure handling for nonzero exits#5
abhinavgautam01 wants to merge 1 commit into
Maxed-OSS:mainfrom
abhinavgautam01:fix/run-json-nonzero-exit

Conversation

@abhinavgautam01

Copy link
Copy Markdown

Fixes #1

Summary

Fixes runners.run_json so subprocess failures are always returned as ok: false, even when the failed command emits valid JSON on stdout.

Previously, run_json only returned command_failed when the command exited nonzero and stdout was empty. If a command exited with a nonzero status but printed valid JSON, the helper parsed it and returned ok: true.

Changes

  • Treat any nonzero subprocess exit code as command_failed
  • Preserve bounded stdout/stderr context in the error detail
  • Add a regression test for nonzero exit plus valid JSON stdout

Validation

  • PYTHONPATH=src pytest -q
  • python3 -m compileall -q src tests
  • git diff --check
  • CI guard denylist scan
  • CI secret-pattern scan

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.

runners.run_json Reports Success for Failed Commands That Emit Valid JSON

1 participant