OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Utility script to generate some output on stdout and stderr. | 5 // Utility script to generate some output on stdout and stderr. |
6 | 6 |
7 import "dart:async"; | 7 import "dart:async"; |
8 import "dart:math"; | 8 import "dart:math"; |
9 import "dart:io"; | 9 import "dart:io"; |
10 | 10 |
11 main() { | 11 main(List<String> arguments) { |
12 var options = new Options(); | 12 var blockCount = int.parse(arguments[0]); |
13 var blockCount = int.parse(options.arguments[0]); | 13 var stdoutBlockSize = int.parse(arguments[1]); |
14 var stdoutBlockSize = int.parse(options.arguments[1]); | 14 var stderrBlockSize = int.parse(arguments[2]); |
15 var stderrBlockSize = int.parse(options.arguments[2]); | |
16 var stdoutBlock = | 15 var stdoutBlock = |
17 new String.fromCharCodes(new List.filled(stdoutBlockSize, 65)); | 16 new String.fromCharCodes(new List.filled(stdoutBlockSize, 65)); |
18 var stderrBlock = | 17 var stderrBlock = |
19 new String.fromCharCodes(new List.filled(stderrBlockSize, 66)); | 18 new String.fromCharCodes(new List.filled(stderrBlockSize, 66)); |
20 for (int i = 0; i < blockCount; i++) { | 19 for (int i = 0; i < blockCount; i++) { |
21 stdout.write(stdoutBlock); | 20 stdout.write(stdoutBlock); |
22 stderr.write(stderrBlock); | 21 stderr.write(stderrBlock); |
23 } | 22 } |
24 Future.wait([stdout.close(), stderr.close()]).then((_) { | 23 Future.wait([stdout.close(), stderr.close()]).then((_) { |
25 exit(int.parse(options.arguments[3])); | 24 exit(int.parse(arguments[3])); |
26 }); | 25 }); |
27 } | 26 } |
OLD | NEW |