You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
ToStringConsumer adds spurious newline to execInContainer outputs #1854
When fetching stdout from an execInContainer Result object, an extra newline is added at the end of each frame. In our case, every 4097th char is a newline, which may break up a word.
The problem exists because ExecInContainerPattern.execInContainer() uses ToStringConsumer to collect stdout and stderr. Said classes adds a newline to before all but the first frame of data.
We need the exact output for our tests, and would appreciate a fix, or at least make this behavior configurable.
Hey @weiminyu thanks for already investigating this, your description sounds valid.
With regards to #1763 it would be nice, if we could solve at a single point, to a bit more DRY.
Would you like to provide a PR for it?
@rnorth@bsideup Anything to add? It would be a "soft" breaking API change in case users are currently depending on this flawed behavior (which might very well be the case).
Update: the issue seems to have gone away by itself. Now I see the entire stdout passed as one OutputFrame to ToStringConsumer, and newline becomes a non-issue.
We did not upgrade testcontainer nor made any obviously related changes. Maybe this is a transitive dependency change wrt Docker?
Our output is less than 8K bytes. I'm unclear if the issue is fixed for all use cases However, for us this is no longer a pressing issue. Please feel free to close.
Thanks for the test case @ReuDa. I used it to create a unit test in this MR where I fixed this: #3752 (I hope this was fine with you, assuming the snippet you posted could be considered public domain).
Activity
kiview commentedon Dec 7, 2019
Hey @weiminyu thanks for already investigating this, your description sounds valid.
With regards to #1763 it would be nice, if we could solve at a single point, to a bit more DRY.
Would you like to provide a PR for it?
@rnorth @bsideup Anything to add? It would be a "soft" breaking API change in case users are currently depending on this flawed behavior (which might very well be the case).
weiminyu commentedon Jan 8, 2020
Update: the issue seems to have gone away by itself. Now I see the entire stdout passed as one OutputFrame to ToStringConsumer, and newline becomes a non-issue.
We did not upgrade testcontainer nor made any obviously related changes. Maybe this is a transitive dependency change wrt Docker?
Our output is less than 8K bytes. I'm unclear if the issue is fixed for all use cases However, for us this is no longer a pressing issue. Please feel free to close.
Thanks.
ReuDa commentedon Oct 5, 2020
We see line breaks again in version 1.15.0-rc2. (Tested with Docker/Mac 2.3.0.5 and 2.4.0.0)
Testcase:
gaeljw commentedon Dec 18, 2020
Same here, upgrading from 1.14.3 to 1.15.1 makes a lot of our tests fail because of newline in the output that we never had before.
Remove extra newlines in container log output
perlun commentedon Feb 2, 2021
Thanks for the test case @ReuDa. I used it to create a unit test in this MR where I fixed this: #3752 (I hope this was fine with you, assuming the snippet you posted could be considered public domain).