-
Notifications
You must be signed in to change notification settings - Fork 1.7k
on Windows, stdout isn't set to binary anymore #22471
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
This comment was originally written by @Fox32 Interesting, this could also be the cause for the protobuf plugin problems that I experience on versions newer than 1.2. The problem only occures on Windows and the output also contains "\r\n", mabye protoc doesn't like that. See also dart-archive/dart-protoc-plugin#25 |
This comment was originally written by @seaneagan Text mode is probably the right default, but binary mode should be allowed as well, so I think this should be merged with issue #19334. |
This comment was originally written by @seaneagan Note that there has not been any comment on issue #19334 yet, maybe someone can be cc'd? |
This comment was originally written by [email protected]
As far as I can tell, the only advantage of text mode is that the output, if redirected to a file, can be properly viewed in Notepad. \n works just fine in the console or virtually any other editor. Even edit.com (the DOS program) was perfectly fine with \n. Try this Java program: class Bla { It outputs these 7 bytes: 66 6F 6F 0A 62 61 72 Which are displayed like: foo Anyhow, if you really want \r\n, you can just output \r\n. Binary mode lets you do that. |
cc @sgjesse. |
This issue was originally filed by [email protected]
This is a regression. Up to 1.2.0, this was fine. It's broken since 1.3.0.
Example:
import 'dart:io';
main(){
stdout.writeCharCode(0x0A); // \n
}
Piped to a file like this:
dart foo.dart > bar.txt
Results in a file which contains these two bytes (\r\n):
0x0D 0x0A
With 1.2.0, you only got the 0x0A (\n) byte.
stdout should be set to binary like it was before and like it is with, say, Java. If it's set to text, writing binary contents to stdout will not work properly on Windows.
The text was updated successfully, but these errors were encountered: