OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // | 4 // |
5 // Simple script hanging for testing a detached process. | 5 // Simple script hanging for testing a detached process. |
6 | 6 |
| 7 import 'dart:io'; |
7 import 'dart:isolate'; | 8 import 'dart:isolate'; |
8 | 9 |
9 main() { | 10 void main(List<String> args) { |
10 new ReceivePort().listen(print); | 11 new ReceivePort().listen(print); |
| 12 |
| 13 // If an argument 'echo' is passed echo stdin to stdout and stderr. |
| 14 if (args.length == 1 && args[0] == 'echo') { |
| 15 stdin.fold([], (p, e) => p..addAll(e)).then((message) { |
| 16 stdout.add(message); |
| 17 stderr.add(message); |
| 18 stdout.close(); |
| 19 stderr.close(); |
| 20 }); |
| 21 } |
11 } | 22 } |
OLD | NEW |