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

Unified Diff: samples/total/server/TotalRunner.dart

Issue 10635015: Delete proxy and total samples, which have bit-rotted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « samples/total/server/SYLKProducer.dart ('k') | samples/total/server/TotalServer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/total/server/TotalRunner.dart
===================================================================
--- samples/total/server/TotalRunner.dart (revision 9011)
+++ samples/total/server/TotalRunner.dart (working copy)
@@ -1,87 +0,0 @@
-#!/usr/bin/env dart
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#library("total:runner");
-
-#import('dart:io');
-
-typedef void ExitCallback(int status, String exitString);
-
-void main() {
- String SERVER_EXEC_PATH = './TotalServer.dart';
- final int RESTART_STATUS = 42;
- final int EXIT_STATUS = 0;
-
- void keepServerRunning(int status, ServerRunner runner) {
- switch (status) {
- case RESTART_STATUS:
- runner.run(keepServerRunning);
- break;
- case EXIT_STATUS:
- break;
- default:
- print("ERROR: exiting due to unknown condition. Exit status: $status.");
- break;
- }
- }
-
- new ServerRunner(SERVER_EXEC_PATH).run(keepServerRunning);
-}
-
-class ServerRunner {
- String _serverMain;
-
- static final DART_EXECS = const <String>[
- '../../../xcodebuild/Release_ia32/dart',
- '../../../out/Release_ia32/dart'];
- static final CR = 0x0d;
- static final LF = 0x0a;
-
- ServerRunner(String this._serverMain);
-
- void run(ExitCallback exitCallback) {
- var foundExec;
- for (String dartExec in DART_EXECS) {
- var file = new File(dartExec);
- if (file.existsSync()) {
- foundExec = dartExec;
- }
- }
- if (foundExec == null) {
- print("No executable found on DART_EXECS:\n" + DART_EXECS);
- exitCallback(1, this);
- return;
- }
- Process dart = Process.start(foundExec, [_serverMain]);
-
- dart.onExit = (int status) {
- dart.close();
- exitCallback(status, this);
- };
-
- dart.stdout.onData = () => readMore(dart.stdout, new StringBuffer());
- dart.stderr.onData = () => readMore(dart.stderr, new StringBuffer());
- }
-
- void readMore(InputStream i, StringBuffer readSoFar) {
- while(i.available() != 0) {
- processBuffer(i.read(), readSoFar);
- }
- }
-
- void processBuffer(List<int> buf, StringBuffer readSoFar) {
- buf.forEach((int i) {
- if (i != CR && i != LF) {
- readSoFar.add(new String.fromCharCodes([i]));
- } else {
- String line = readSoFar.toString();
- readSoFar.clear();
- if (line.length != 0) {
- print(line);
- }
- }
- });
- }
-}
« no previous file with comments | « samples/total/server/SYLKProducer.dart ('k') | samples/total/server/TotalServer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698