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.
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

1 participant