993865a051
The _StringDecoder did not handle unsubscribe correctly (the added test did not terminate as the unsubscribe did not cause stdin to be closed) Fixed by extending StreamEventTransformer which has all the logic. Changed a number of other transformers to use StreamEventTransformer as well. Fixed a bug in the StreamEventTransformer implementation. R=floitsch@google.com BUG= Review URL: https://codereview.chromium.org//12313127 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19046 260f80e4-7a28-3924-810f-c04153c831b5
19 lines
554 B
Dart
19 lines
554 B
Dart
// 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();
|
|
});
|
|
}
|