Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "dart:io"; | |
| 6 | |
| 7 void main() { | |
| 8 var script = new Path(Platform.script).directoryPath; | |
| 9 script = script.append("stdin_sync_script.dart"); | |
| 10 print(script.toNativePath()); | |
| 11 Process.start(Platform.executable, [script.toNativePath()]).then((process) { | |
| 12 process.stdin.write("hej\x01\x00\x0d\x0a\x0a4\x0a"); | |
|
Bill Hesse
2013/07/02 11:31:54
Also try a case with no newline at EOF?
Anders Johnsen
2013/07/02 12:21:27
Done.
| |
| 13 process.stdin.close(); | |
| 14 process.stdout | |
| 15 .transform(new StringDecoder()) | |
| 16 .transform(new LineTransformer()) | |
| 17 .fold(new StringBuffer(), (b, d) => b..write(d)) | |
| 18 .then((data) { | |
| 19 if (data.toString() != 'true') throw "Bad output: '$data'"; | |
| 20 }); | |
| 21 }); | |
| 22 } | |
| OLD | NEW |