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

Side by Side Diff: runtime/bin/process_impl.dart

Issue 10069053: Fix Process test, fix Process factory, diable tests on dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « no previous file | tests/standalone/src/io/ProcessRunOutputTest.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _ProcessStartStatus { 5 class _ProcessStartStatus {
6 int _errorCode; // Set to OS error code if process start failed. 6 int _errorCode; // Set to OS error code if process start failed.
7 String _errorMessage; // Set to OS error message if process start failed. 7 String _errorMessage; // Set to OS error message if process start failed.
8 } 8 }
9 9
10 10
11 // Abstract factory class capable of producing interactive and 11 // Abstract factory class capable of producing interactive and
12 // non-interactive processes. 12 // non-interactive processes.
13 class _Process implements Process { 13 class _Process {
14 14
15 _Process(); 15 factory Process.start(String path,
16 16 List<String> arguments,
17 factory _Process.start(String path, 17 [ProcessOptions options]) {
18 List<String> arguments,
19 [ProcessOptions options]) {
20 return new _InteractiveProcess.start(path, arguments, options); 18 return new _InteractiveProcess.start(path, arguments, options);
21 } 19 }
22 20
23 factory _Process.run(String path, 21 factory Process.run(String path,
24 List<String> arguments, 22 List<String> arguments,
25 ProcessOptions options, 23 ProcessOptions options,
26 void callback(int exitCode, 24 void callback(int exitCode,
27 String stdout, 25 String stdout,
28 String stderr)) { 26 String stderr)) {
29 return new _NonInteractiveProcess.start(path, 27 return new _NonInteractiveProcess.start(path,
30 arguments, 28 arguments,
31 options, 29 options,
32 callback); 30 callback);
33 } 31 }
34 } 32 }
35 33
36 34
37 // _InteractiveProcess is the actual implementation of all processes 35 // _InteractiveProcess is the actual implementation of all processes
38 // started from Dart code. 36 // started from Dart code.
39 class _InteractiveProcess extends _Process { 37 class _InteractiveProcess implements Process {
40 38
41 _InteractiveProcess.start(String path, 39 _InteractiveProcess.start(String path,
42 List<String> arguments, 40 List<String> arguments,
43 ProcessOptions options) { 41 ProcessOptions options) {
44 if (path is !String) { 42 if (path is !String) {
45 throw new IllegalArgumentException("Path is not a String: $path"); 43 throw new IllegalArgumentException("Path is not a String: $path");
46 } 44 }
47 _path = path; 45 _path = path;
48 46
49 if (arguments is !List) { 47 if (arguments is !List) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 Function _onExit; 286 Function _onExit;
289 Function _onError; 287 Function _onError;
290 Function _onStart; 288 Function _onStart;
291 } 289 }
292 290
293 291
294 // _NonInteractiveProcess is a wrapper around an interactive process 292 // _NonInteractiveProcess is a wrapper around an interactive process
295 // that restricts the interface to disallow access to the streams and 293 // that restricts the interface to disallow access to the streams and
296 // buffers output so it can be delivered to the callback when the 294 // buffers output so it can be delivered to the callback when the
297 // process exits. 295 // process exits.
298 class _NonInteractiveProcess extends _Process { 296 class _NonInteractiveProcess implements Process {
299 297
300 _NonInteractiveProcess.start(String path, 298 _NonInteractiveProcess.start(String path,
301 List<String> arguments, 299 List<String> arguments,
302 ProcessOptions options, 300 ProcessOptions options,
303 Function this._callback) { 301 Function this._callback) {
304 _process = new _InteractiveProcess.start(path, arguments, options); 302 _process = new _InteractiveProcess.start(path, arguments, options);
305 303
306 // Setup process exit handling. 304 // Setup process exit handling.
307 _process.onExit = (exitCode) { 305 _process.onExit = (exitCode) {
308 _exitCode = exitCode; 306 _exitCode = exitCode;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 void close() => _process.close(); 396 void close() => _process.close();
399 397
400 Process _process; 398 Process _process;
401 Function _callback; 399 Function _callback;
402 StringBuffer _stdoutBuffer; 400 StringBuffer _stdoutBuffer;
403 StringBuffer _stderrBuffer; 401 StringBuffer _stderrBuffer;
404 int _exitCode; 402 int _exitCode;
405 bool _stdoutClosed = false; 403 bool _stdoutClosed = false;
406 bool _stderrClosed = false; 404 bool _stderrClosed = false;
407 } 405 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/src/io/ProcessRunOutputTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698