fix: make binmode the default on Win32 to prevent newline mangling#192
fix: make binmode the default on Win32 to prevent newline mangling#192toddr merged 3 commits intocpan-authors:mainfrom
Conversation
|
@Koan-Bot rebase |
1 similar comment
|
@Koan-Bot rebase |
a8ffe9f to
6ef2138
Compare
Rebase: fix: make binmode the default on Win32 to prevent newline manglingBranch Diff: 3 files changed, 8 insertions(+), 6 deletions(-) Review feedback was analyzed and applied. Actions
CICI still failing after 2 fix attempts. Last failure logsAutomated by Kōan |
|
@Koan-Bot rebase |
21fd876 to
13afd54
Compare
Rebase: fix: make binmode the default on Win32 to prevent newline manglingBranch Diff: 5 files changed, 18 insertions(+), 8 deletions(-) Review feedback was analyzed and applied. Actions
CICI still failing after 2 fix attempts. Last failure logsAutomated by Kōan |
|
@Koan-Bot rebase windows is still failing |
On Windows, IPC::Run was silently translating newlines (\n <-> \r\n) by
default when piping data to/from child processes. This corrupts binary
data (PDFs, images, etc.) and is surprising behavior for any caller that
expects raw data to pass through unchanged.
Change the default $binmode from 0 to 1 for both input ('<') and output
('>') redirection operators in harness(). Users who need the old
newline-translating behavior can opt back in with binary(0).
Update t/binmode.t to reflect the new defaults:
- "no binary" now preserves \r\n (binmode=1 default)
- binary(0) now represents explicit opt-in to translation (old behavior)
- Remove Win32-specific expected-value adjustments for the default case
Remove local $TODO from t/win32_newlines.t — the tests are now expected
to pass on Win32.
Fixes cpan-authors#116
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- **t/close_stdin.t**: Added `$nl` variable (`\r\n` on Win32, `\n` elsewhere) and used it in 3 string comparisons at lines 68, 135, 172 — these tests now account for binmode=1 preserving `\r\n` from child processes on Windows - **t/pump.t**: Added `$nl` variable and updated 3 string comparisons at lines 60, 68, 85; also adjusted the `/hello\n/g` regex to `/hello\r?\n/g` and the `pos()` check to use dynamic length — matches the binmode=1 behavior on Windows - **t/run.t**: Added `$out =~ s/\r\n/\n/g if IPC::Run::Win32_MODE()` normalization before 3 assertions at lines 525, 543, and 947 — consistent with the existing normalization pattern already used in `eok()` and at line 1039 - **t/win32_newlines.t**: Removed `%todo_tests` hash and `local $TODO` marker — tests 3, 8, 9 now pass on Win32 with binmode=1 default, so they should no longer be marked TODO All changes fix Windows CI failures caused by binmode=1 default making `\r\n` pass through unchanged where tests previously expected `\n`.
13afd54 to
46ffbbb
Compare
Rebase: fix: make binmode the default on Win32 to prevent newline manglingBranch Diff: 8 files changed, 35 insertions(+), 20 deletions(-) Review feedback was analyzed and applied. Changes
All changes fix Windows CI failures caused by binmode=1 default making Actions
CICI passed. Automated by Kōan |
The TODO tests from PR cpan-authors#216 (tests 3, 8, 9) were already resolved by PR cpan-authors#192 which made binmode the default on Win32. The TODO markers were removed in that PR but left behind a stale $test_num variable and a historical comment that are no longer needed. Remove both. Closes cpan-authors#223 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
On Windows, IPC::Run was silently translating newlines (
\n↔\r\n) by default when piping data to/from child processes. This corrupts binary data (PDFs, images, etc.) and surprises callers who expect raw bytes to pass through unchanged. This PR makes binmode the default, so newline translation is opt-in rather than opt-out.Fixes #116
Changes
$binmode = 1as the default for both<and>redirection inharness()(lib/IPC/Run.pm)t/binmode.tto expect\r\nto be preserved by default;binary(0)now represents the old translating behaviorlocal $TODOfromt/win32_newlines.t— the tests should now pass on Win32Notes
binary()/binary(1)behave the same as before (binmode on)binary(0)can be used to explicitly re-enable the old newline-translation behavior for callers that need itTest plan
prove -Ilib t/— all green)t/win32_newlines.tis now expected to pass on Win32 (was previously markedlocal $TODO)Generated by Kōan /fix
Quality Report
Changes: 3 files changed, 8 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline