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

stdout shouldn't modify binary data on Windows #23303

Closed
nex3 opened this issue Apr 22, 2015 · 3 comments
Closed

stdout shouldn't modify binary data on Windows #23303

nex3 opened this issue Apr 22, 2015 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-io

Comments

@nex3
Copy link
Member

nex3 commented Apr 22, 2015

Currently on Windows, if a List<int> is passed to stdout.add (or stderr.add), any instance of the byte 0xA (an ASCII newline) is replaced by the sequence 0xD 0xA (an ASCII carriage return followed by an ASCII newline). This means that any pure binary data emitted via stdout will be corrupted on Windows. Even when not emitting pure binary data, a subprocess that emits its own \r\n sequences will have an extra \r added if its stdout is piped to the host process's stdout.

@nex3
Copy link
Member Author

nex3 commented Apr 22, 2015

Here's a repro:

    // inner.dart
    import 'dart:io';

    void main() {
      stdout.add(["\n".runes.single]);
    }

    // outer.dart
    import 'dart:io';

    void main() {
      var result = Process.runSync(Platform.executable, ["inner.dart"],
          stdoutEncoding: null);
      print(result.stdout);
    }

When run on Linux, this prints "[10]". On Windows, it prints "[13, 10]".

@DartBot
Copy link

DartBot commented Apr 23, 2015

This comment was originally written by @Fox32


The same as issue #19334 and issue #22471?

@nex3
Copy link
Member Author

nex3 commented Apr 23, 2015

Added Duplicate label.
Marked as being merged into #19334.

@nex3 nex3 added Type-Defect library-io area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report labels Apr 23, 2015
This issue was closed.
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. closed-duplicate Closed in favor of an existing report library-io
Projects
None yet
Development

No branches or pull requests

3 participants