OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #library("total:dartcompiler"); | 5 #library("total:dartcompiler"); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 | 8 |
9 /** | 9 /** |
10 * A simple wrapper around the Dart compiler (runs frog). | 10 * A simple wrapper around the Dart compiler (runs frog). |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 if (checkOnly) { | 53 if (checkOnly) { |
54 args.add('--check-only'); | 54 args.add('--check-only'); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 args.add(scriptName); | 58 args.add(scriptName); |
59 | 59 |
60 Process compiler = new Process.start(_frogExecPath, args); | 60 Process compiler = new Process.start(_frogExecPath, args); |
61 StringBuffer messages = new StringBuffer(); | 61 StringBuffer messages = new StringBuffer(); |
62 compiler.exitHandler = (int status) { | 62 compiler.onExit = (int status) { |
63 compiler.close(); | 63 compiler.close(); |
64 callback(status, messages.toString()); | 64 callback(status, messages.toString()); |
65 }; | 65 }; |
66 | 66 |
67 compiler.stdout.dataHandler = () => _readAll(compiler.stdout, messages); | 67 compiler.stdout.onData = () => _readAll(compiler.stdout, messages); |
68 compiler.stderr.dataHandler = () => _readAll(compiler.stderr, messages); | 68 compiler.stderr.onData = () => _readAll(compiler.stderr, messages); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void _readAll(InputStream input, StringBuffer output) { | 72 void _readAll(InputStream input, StringBuffer output) { |
73 while (input.available() != 0) { | 73 while (input.available() != 0) { |
74 output.add(new String.fromCharCodes(input.read())); | 74 output.add(new String.fromCharCodes(input.read())); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
OLD | NEW |