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

Side by Side Diff: samples/total/src/Dartc.dart

Issue 8292003: Total now reads mortgage sample from server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Process stdout and stderr renames Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/samples/total/src/Total.dart ('k') | samples/total/src/GetSpreadsheet.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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("total:dartc"); 5 #library("total:dartc");
6 6
7 /** 7 /**
8 * A simple wrapper around dartc. 8 * A simple wrapper around dartc.
9 * TODO: automatically determine the exec path to dartc 9 * TODO: automatically determine the exec path to dartc
10 * TODO: prevent ANSI colors from being exposed to the user 10 * TODO: prevent ANSI colors from being exposed to the user
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 args.add(scriptName); 47 args.add(scriptName);
48 48
49 Process compiler = new Process(DARTC_EXEC_PATH, args); 49 Process compiler = new Process(DARTC_EXEC_PATH, args);
50 50
51 compiler.setExitHandler((int status) { 51 compiler.setExitHandler((int status) {
52 StringBuffer messages = new StringBuffer(); 52 StringBuffer messages = new StringBuffer();
53 if(status != 0) { 53 if(status != 0) {
54 // TODO(rchandia) increase read size when stream handling works better 54 // TODO(rchandia) increase read size when stream handling works better
55 int BUFSIZE = 1; 55 int BUFSIZE = 1;
56 56
57 _readAll(false, compiler.stdoutStream, new List<int>(BUFSIZE), message s); 57 _readAll(false, compiler.stdout, new List<int>(BUFSIZE), messages);
58 _readAll(false, compiler.stderrStream, new List<int>(BUFSIZE), message s); 58 _readAll(false, compiler.stderr, new List<int>(BUFSIZE), messages);
59 } 59 }
60 compiler.close(); 60 compiler.close();
61 callback(status, messages.toString()); 61 callback(status, messages.toString());
62 }); 62 });
63 63
64 compiler.start(); 64 compiler.start();
65 } 65 }
66 } 66 }
67 67
68 void _readAll(bool fromCallback, InputStream input, List<int> buffer, StringBuff er output) { 68 void _readAll(bool fromCallback, InputStream input, List<int> buffer, StringBuff er output) {
69 if (fromCallback) { 69 if (fromCallback) {
70 output.add(new String.fromCharCodes(buffer)); 70 output.add(new String.fromCharCodes(buffer));
71 } 71 }
72 while (input.read(buffer, 0, buffer.length, () => _readAll(true, input, buffer , output))) { 72 while (input.read(buffer, 0, buffer.length, () => _readAll(true, input, buffer , output))) {
73 output.add(new String.fromCharCodes(buffer)); 73 output.add(new String.fromCharCodes(buffer));
74 } 74 }
75 } 75 }
76 76
OLDNEW
« no previous file with comments | « client/samples/total/src/Total.dart ('k') | samples/total/src/GetSpreadsheet.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698