| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |