-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[breaking change] Add lineTerminator
field to Stdout
#53863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
lineTerminator
field to Stdout
SGTM. No impact to ACX. |
FYI, https://github.com/tvolkert/universal_io was a clone of another repo -- I just deleted my clone. |
I think that could be a reasonable breaking change, though it might lead to some subtle breakages when output contents suddenly change, e.g. if people produce files by redirecting output then contents of these files will change. |
no objection from me |
I tried that initially but it is too breaking - there are a lot of CLI projects with tests that assert their output. If the default output changes to "\r\n" on Windows then their Windows tests would break. |
lgtm |
Fixed in 770f44d |
Change Intent
To make it possible for
stdout/stderr
to correctly output Windows line endings ('\r\n'
) whenwrite
/writeln
by adding a new field:The default value of
lineTerminator
will be"\n"
so the output will not change for existing Dart code.Justification
To write correct terminal applications on Windows, developers currently have to write awkward code like:
Impact
Any class that
implements Stdout
without usingMock
/Mock
or overridingnoSuchMethod
will break.There are 100s of files on github that
implement Stdout
but most them that I looked at useFake
/Mock
or overridenoSuchMethod
.A few do not:
https://github.com/onepub-dev/minion/blob/57cda065a6fc489839d0cbf80d15f6d08432e614/lib/src/stdout.dart#L7
https://github.com/tvolkert/universal_io/blob/02f99955f2dfbc94269ddfa8d326a1bbe7787e8e/lib/src/driver_base/base_std_out.dart#L21
https://github.com/filiph/linkcheck/blob/8ab5f5b516701f98c18cb2f16a73e5f93ebf7f12/test/e2e_test.dart#L218
Mitigation
Developers will have to add:
+ String lineEnding;
to their
Stdout
implementations.Change Timeline
N/A
Associated CLs
stdout
andstderr
.The text was updated successfully, but these errors were encountered: