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

Unified Diff: tests/standalone/io/process_stdin_transform_unsubscribe_script.dart

Issue 12313127: Fix subscription handling in stream decoder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 10 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/utf/utf_stream.dart ('k') | tests/standalone/io/process_stdin_transform_unsubscribe_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/process_stdin_transform_unsubscribe_script.dart
diff --git a/tests/standalone/io/process_stdin_transform_unsubscribe_script.dart b/tests/standalone/io/process_stdin_transform_unsubscribe_script.dart
new file mode 100644
index 0000000000000000000000000000000000000000..071112488a9d03915796316a3d51a058b0a830cf
--- /dev/null
+++ b/tests/standalone/io/process_stdin_transform_unsubscribe_script.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Utility script to echo stdin to stdout or stderr or both.
+
+import "dart:io";
+
+main() {
+ var subscription;
+ subscription = stdin
+ .transform(new StringDecoder())
+ .transform(new LineTransformer())
+ .listen((String line) {
+ // Unsubscribe after the first line.
+ subscription.cancel();
+ });
+}
« no previous file with comments | « sdk/lib/utf/utf_stream.dart ('k') | tests/standalone/io/process_stdin_transform_unsubscribe_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698