Preserve subprocess results with non-UTF-8 output - #1184
Open
jackwalkerlabs wants to merge 2 commits into
Open
Conversation
jackwalkerlabs
requested review from
gaborbernat,
henryiii and
layday
as code owners
September 8, 2026 02:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A build tool emitting non-UTF-8 bytes replaces its actual exit error with
UnicodeDecodeError. In verbose mode the same decoding failure can abort a successful tool invocation. Decode diagnostics withbackslashreplacein both captured and streamed output so the original byte is visible and the subprocess exit status is preserved.Three regressions run real Python subprocesses emitting byte 0xff, covering failed commands in quiet and verbose modes and successful verbose output. All fail before the change. Validation: 304 tests plus 5 subtests pass (47 platform/integration skips), Pyrefly reports zero errors and 100% public type coverage, and all changed-file pre-commit checks pass.
Implemented and locally validated with OpenAI Codex.
Issue tracking: Found during source inspection; no matching open issue was identified for this fix.