Skip to content

fix: preserve stderr output when stdout is not empty during check runs #97

Closed

Description

@YasserYG8

Description:

In becwright.engine._run_check, the engine captures and processes stdout/stderr of check subprocesses using a short-circuiting logical or:

output = proc.stdout.strip() or proc.stderr.strip()

If a check command prints standard logging or status to stdout but writes error tracebacks, linter warning details, or debug messages to stderr, proc.stderr is silently ignored and discarded. As a result, the developer sees that the commit is blocked (from the non-zero exit code), but has no error detail in the output since it was printed to stderr.


Steps to Reproduce

  1. Define a rule that calls a custom script.
  2. Make the custom script print to both standard output and standard error:
    import sys
    print("Initializing check...")
    print("Error: division by zero! Traceback...", file=sys.stderr)
    sys.exit(1)
  3. Run becwright check.
  4. Observe that the check blocks, but ONLY prints Initializing check.... The error message is completely lost.

Proposed Fix

Modify src/becwright/engine.py to concatenate both stdout and stderr outputs if they are present, rather than discarding stderr:

outputs = [proc.stdout.strip(), proc.stderr.strip()]
output = "\n".join(o for o in outputs if o).strip()

Activity

  1. added
    bug
    on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions