Commit e236edc
Scrub invalid bytes when normalizing command output
When captured subprocess output contained a byte that isn't valid UTF-8,
normalize tagged the buffer as UTF-8 and then ran gsub over it, which
scans the whole string and raised Encoding::CompatibilityError: invalid
byte sequence in UTF-8. The error surfaced from inside the test harness
rather than on an assertion, so RSpec reported "Unable to find matching
line from backtrace" and the real output was lost.
Scrub the string after forcing the encoding so normalize never raises on
malformed bytes, and dup it first so forcing the encoding no longer
mutates the stored capture buffer.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 0365a17 commit e236edc
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
0 commit comments