-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot write to stdout in binary mode in Windows #19334
Comments
Added Area-Library, Library-IO, Triaged labels. |
Issue #23303 has been merged into this issue. |
This is also important for use-cases like emitting actual binary data on stdout, or piping the output from subprocesses that emit their own CR/LF sequences. Also, as issue #22471 points out, other than Notepad no programs on Windows have trouble with raw LFs in practice. |
@sgjesse We're hitting this with test. Breaking anything that is using Process.start |
Every other file opened in Windows is in binary mode, and there is no way of opening a file in text mode. This is a breaking change if one is relying on the CR insertion when writing to stdout/stderr on Windows. BUG=#19334 [email protected] Review URL: https://codereview.chromium.org//1228053002.
Fixed in 4205b29. |
Awesome, thanks Søren! |
This issue was originally filed by @seaneagan
See: http://stackoverflow.com/questions/24129102/dart-print-newline-without-carriage-return-on-windows
There are many use cases for writing binary output to stdout. My particular use case is just turning off the newline conversion from LF to CRLF on windows. I want to output unix line endings from a windows dart vm, which is necessary to make certain things work correctly in cygwin (unix-like environment for windows), for example.
Ruby:
http://www.ruby-doc.org/core-2.1.2/IO.html#method-i-binmode
Python:
https://docs.python.org/3.0/library/sys.html#sys.stdout
I noticed
IOSink.add
already turns off encoding conversion, maybe it could turn off newline conversion as well?Or maybe add a getter on
stdout
which returns anIOSink
in binary mode?Something which doesn't mutate the global
stdout
would be preferable.The text was updated successfully, but these errors were encountered: