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

Side by Side Diff: samples/total/server/TotalRunner.dart

Issue 10392023: Change dart:io to use Future for one-shot operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding stable test binaries Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/leap/leap_server.dart ('k') | tests/standalone/io/dart_std_io_pipe_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #library("total:runner"); 6 #library("total:runner");
7 7
8 #import('dart:io'); 8 #import('dart:io');
9 9
10 typedef void ExitCallback(int status, String exitString); 10 typedef void ExitCallback(int status, String exitString);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 var foundExec; 45 var foundExec;
46 for (String dartExec in DART_EXECS) { 46 for (String dartExec in DART_EXECS) {
47 var file = new File(dartExec); 47 var file = new File(dartExec);
48 if (file.existsSync()) { 48 if (file.existsSync()) {
49 foundExec = dartExec; 49 foundExec = dartExec;
50 } 50 }
51 } 51 }
52 if (foundExec == null) { 52 if (foundExec == null) {
53 print("No executable found on DART_EXECS:\n" + DART_EXECS); 53 print("No executable found on DART_EXECS:\n" + DART_EXECS);
54 exitCallback(1, this); 54 exitCallback(1, this);
55 return; 55 return;
56 } 56 }
57 Process dart = new Process.start(foundExec, [_serverMain]); 57 Process dart = Process.start(foundExec, [_serverMain]);
58 58
59 dart.onExit = (int status) { 59 dart.onExit = (int status) {
60 dart.close(); 60 dart.close();
61 exitCallback(status, this); 61 exitCallback(status, this);
62 }; 62 };
63 63
64 dart.stdout.onData = () => readMore(dart.stdout, new StringBuffer()); 64 dart.stdout.onData = () => readMore(dart.stdout, new StringBuffer());
65 dart.stderr.onData = () => readMore(dart.stderr, new StringBuffer()); 65 dart.stderr.onData = () => readMore(dart.stderr, new StringBuffer());
66 } 66 }
67 67
(...skipping 10 matching lines...) Expand all
78 } else { 78 } else {
79 String line = readSoFar.toString(); 79 String line = readSoFar.toString();
80 readSoFar.clear(); 80 readSoFar.clear();
81 if (line.length != 0) { 81 if (line.length != 0) {
82 print(line); 82 print(line);
83 } 83 }
84 } 84 }
85 }); 85 });
86 } 86 }
87 } 87 }
OLDNEW
« no previous file with comments | « samples/leap/leap_server.dart ('k') | tests/standalone/io/dart_std_io_pipe_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698