| 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 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 new ServerRunner(SERVER_EXEC_PATH).run(keepServerRunning); | 30 new ServerRunner(SERVER_EXEC_PATH).run(keepServerRunning); |
| 31 } | 31 } |
| 32 | 32 |
| 33 class ServerRunner { | 33 class ServerRunner { |
| 34 String _serverMain; | 34 String _serverMain; |
| 35 | 35 |
| 36 // TODO: Release or Debug? We should be able to find automatically | 36 // TODO: Release or Debug? We should be able to find automatically |
| 37 static final DART_EXEC_PATH = '../../../out/Release_ia32/dart'; | 37 static final DART_EXEC_PATH = '../../../xcodebuild/Release_ia32/dart'; |
| 38 static final CR = 0x0d; | 38 static final CR = 0x0d; |
| 39 static final LF = 0x0a; | 39 static final LF = 0x0a; |
| 40 | 40 |
| 41 ServerRunner(String this._serverMain); | 41 ServerRunner(String this._serverMain); |
| 42 | 42 |
| 43 void run(ExitCallback exitCallback) { | 43 void run(ExitCallback exitCallback) { |
| 44 Process dart = new Process.start(DART_EXEC_PATH, [_serverMain]); | 44 Process dart = new Process.start(DART_EXEC_PATH, [_serverMain]); |
| 45 | 45 |
| 46 dart.exitHandler = (int status) { | 46 dart.exitHandler = (int status) { |
| 47 dart.close(); | 47 dart.close(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 } else { | 65 } else { |
| 66 String line = readSoFar.toString(); | 66 String line = readSoFar.toString(); |
| 67 readSoFar.clear(); | 67 readSoFar.clear(); |
| 68 if (line.length != 0) { | 68 if (line.length != 0) { |
| 69 print(line); | 69 print(line); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 }); | 72 }); |
| 73 } | 73 } |
| 74 } | 74 } |
| OLD | NEW |