Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: sdk/lib/io/stdio.dart

Issue 686703002: Revert "Make stdout/stderr async" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/stdio.dart
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index e4bdf01ff05c7bb0b6d68ba8c53d1a743d319d0c..f36dd833366e0a982550bf2e7f55beeaed4ddcff 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -191,6 +191,36 @@ class StdoutException implements IOException {
}
+class _StdConsumer implements StreamConsumer<List<int>> {
+ final _file;
+
+ _StdConsumer(int fd) : _file = _File._openStdioSync(fd);
+
+ Future addStream(Stream<List<int>> stream) {
+ var completer = new Completer();
+ var sub;
+ sub = stream.listen(
+ (data) {
+ try {
+ _file.writeFromSync(data);
+ } catch (e, s) {
+ sub.cancel();
+ completer.completeError(e, s);
+ }
+ },
+ onError: completer.completeError,
+ onDone: completer.complete,
+ cancelOnError: true);
+ return completer.future;
+ }
+
+ Future close() {
+ _file.closeSync();
+ return new Future.value();
+ }
+}
+
+
class _StdSink implements IOSink {
final IOSink _sink;
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698