Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/testing/dart/test_suite.dart

Issue 11091070: Change Process.start to return a future that completes with a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
});
}

Powered by Google App Engine
This is Rietveld 408576698