Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
| index 3ada3b77161286aaa3352734c6e8bfd3bbba3b38..ce03365b86a16aeb34490b0b6d0a4026662dab6f 100644 |
| --- a/tools/testing/dart/test_suite.dart |
| +++ b/tools/testing/dart/test_suite.dart |
| @@ -65,31 +65,38 @@ bool Contains(element, collection) => collection.indexOf(element) >= 0; |
| void ccTestLister() { |
| port.receive((String runnerPath, SendPort replyTo) { |
| - var p = Process.start(runnerPath, ["--list"]); |
| - StringInputStream stdoutStream = new StringInputStream(p.stdout); |
| - List<String> tests = new List<String>(); |
| - stdoutStream.onLine = () { |
| - String line = stdoutStream.readLine(); |
| - while (line != null) { |
| - tests.add(line); |
| - line = stdoutStream.readLine(); |
| - } |
| - }; |
| - p.onError = (error) { |
| + void processErrorHandler(error) { |
| print("Failed to list tests: $runnerPath --list"); |
| replyTo.send(""); |
| - }; |
| - p.onExit = (code) { |
| - if (code < 0) { |
| - print("Failed to list tests: $runnerPath --list"); |
| + } |
| + Future processFuture = Process.start(runnerPath, ["--list"]); |
| + processFuture.then((p) { |
| + StringInputStream stdoutStream = new StringInputStream(p.stdout); |
| + List<String> tests = new List<String>(); |
| + stdoutStream.onLine = () { |
| + String line = stdoutStream.readLine(); |
| + while (line != null) { |
| + tests.add(line); |
| + line = stdoutStream.readLine(); |
| + } |
| + }; |
| + p.onError = processErrorHandler; |
| + p.onExit = (code) { |
| + if (code < 0) { |
| + print("Failed to list tests: $runnerPath --list"); |
| + replyTo.send(""); |
| + } |
| + for (String test in tests) { |
| + replyTo.send(test); |
| + } |
| replyTo.send(""); |
| - } |
| - for (String test in tests) { |
| - replyTo.send(test); |
| - } |
| - replyTo.send(""); |
| - }; |
| - port.close(); |
| + }; |
| + port.close(); |
| + }); |
| + processFuture.handleException((e) { |
| + processErrorHandler(e); |
| + return true; |
| + }); |
|
Søren Gjesse
2012/10/12 07:47:22
This code is now 7 lines longer...
Mads Ager (google)
2012/10/12 08:44:46
I know. I removed onError on process. That means t
|
| }); |
| } |