Skip to content
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

Closed
DartBot opened this issue Jun 10, 2014 · 7 comments
Closed

Cannot write to stdout in binary mode in Windows #19334

DartBot opened this issue Jun 10, 2014 · 7 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io

Comments

@DartBot
Copy link

DartBot commented Jun 10, 2014

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 an IOSink in binary mode?

Something which doesn't mutate the global stdout would be preferable.

@kasperl
Copy link

kasperl commented Jun 11, 2014

Added Area-Library, Library-IO, Triaged labels.

@nex3
Copy link
Member

nex3 commented Apr 23, 2015

Issue #23303 has been merged into this issue.

@nex3
Copy link
Member

nex3 commented Apr 23, 2015

Issue #22471 has been merged into this issue.


cc @sgjesse.

@nex3
Copy link
Member

nex3 commented Apr 23, 2015

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.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels Apr 23, 2015
@kevmoo kevmoo changed the title Cannot write to stdout in binary mode Cannot write to stdout in binary mode in Windows Jul 8, 2015
@kevmoo
Copy link
Member

kevmoo commented Jul 8, 2015

@sgjesse We're hitting this with test. Breaking anything that is using Process.start

sgjesse added a commit that referenced this issue Jul 10, 2015
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.
@sgjesse
Copy link
Contributor

sgjesse commented Jul 10, 2015

Fixed in 4205b29.

@nex3
Copy link
Member

nex3 commented Jul 10, 2015

Awesome, thanks Søren!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

5 participants