Skip to content

fix: split process output on \n instead of os.EOL - #332

Open
Noethix55555 wants to merge 1 commit into
extrabacon:masterfrom
Noethix55555:fix/newline-split
Open

fix: split process output on \n instead of os.EOL#332
Noethix55555 wants to merge 1 commit into
extrabacon:masterfrom
Noethix55555:fix/newline-split

Conversation

@Noethix55555

Copy link
Copy Markdown

Fixes #331.

NewlineTransformer split stdout/stderr on os.EOL. On Windows that is \r\n, so output using bare \n line endings was never split into messages: the data was buffered in _lastLineData and dropped, because _flush runs after the stream's end handler has already resolved the run()/end() callback. print() worked only because Python's text-mode stdout translates \n to \r\n on Windows.

Split on /\r?\n/ so both line endings are handled.

Added a regression test against the exported NewlineTransformer (deterministic and OS independent). It fails on the previous code for the bare-\n case and passes with the fix.

NewlineTransformer split stdout/stderr on os.EOL. On Windows that is
\r\n, so output using bare \n line endings was never split into
messages: the data was buffered and dropped, because _flush runs after
the stream's end handler has already resolved the run()/end() callback.
Normal print() worked only because Python's text-mode stdout translates
\n to \r\n on Windows.

Split on /\r?\n/ so both line endings are handled.

@PNHD PNHD left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 9fe76e4 against #331.

Splitting on /\r?\n/ fixes bare-LF output on Windows while preserving CRLF handling. Because _lastLineData is prepended before splitting, a CRLF pair split across two stream chunks is still reconstructed and emitted as one normal line.

The focused transformer tests cover both LF and CRLF without expanding into the separate bare-CR behavior from #325. LGTM.

@PNHD PNHD mentioned this pull request Sep 2, 2026
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.

Output using bare \n line endings is dropped on Windows

2 participants