OLD | NEW |
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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 // TODO(ager): The only reason for this class is that we | 7 // TODO(ager): The only reason for this class is that we |
8 // cannot patch a top-level at this point. | 8 // cannot patch a top-level at this point. |
9 class _ProcessUtils { | 9 class _ProcessUtils { |
10 external static _exit(int status); | 10 external static _exit(int status); |
(...skipping 24 matching lines...) Expand all Loading... |
35 if (status is !int) { | 35 if (status is !int) { |
36 throw new ArgumentError("setExitCode: int status expected"); | 36 throw new ArgumentError("setExitCode: int status expected"); |
37 } | 37 } |
38 _ProcessUtils._setExitCode(status); | 38 _ProcessUtils._setExitCode(status); |
39 } | 39 } |
40 | 40 |
41 /** | 41 /** |
42 * [Process] is used to start new processes using the static | 42 * [Process] is used to start new processes using the static |
43 * [start] and [run] methods. | 43 * [start] and [run] methods. |
44 */ | 44 */ |
45 abstract class Process { | 45 abstract class Process extends StreamSink { |
46 /** | 46 /** |
47 * Starts a process running the [executable] with the specified | 47 * Starts a process running the [executable] with the specified |
48 * [arguments]. Returns a [:Future<Process>:] that completes with a | 48 * [arguments]. Returns a [:Future<Process>:] that completes with a |
49 * Process instance when the process has been successfully | 49 * Process instance when the process has been successfully |
50 * started. That [Process] object can be used to interact with the | 50 * started. That [Process] object can be used to interact with the |
51 * process. If the process cannot be started the returned [Future] | 51 * process. If the process cannot be started the returned [Future] |
52 * completes with an exception. | 52 * completes with an exception. |
53 * | 53 * |
54 * An optional [ProcessOptions] object can be passed to specify | 54 * An optional [ProcessOptions] object can be passed to specify |
55 * options other than the executable and the arguments. | 55 * options other than the executable and the arguments. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 InputStream get stderr; | 95 InputStream get stderr; |
96 | 96 |
97 /** | 97 /** |
98 * Returns an output stream to the process stdin. | 98 * Returns an output stream to the process stdin. |
99 * | 99 * |
100 * Throws an [UnsupportedError] if the process is | 100 * Throws an [UnsupportedError] if the process is |
101 * non-interactive. | 101 * non-interactive. |
102 */ | 102 */ |
103 OutputStream get stdin; | 103 OutputStream get stdin; |
104 | 104 |
| 105 |
| 106 Stream<List<int>> get stdoutStream; |
| 107 Stream<List<int>> get stderrStream; |
| 108 |
105 /** | 109 /** |
106 * Sets an exit handler which gets invoked when the process | 110 * Sets an exit handler which gets invoked when the process |
107 * terminates. | 111 * terminates. |
108 * | 112 * |
109 * Throws an [UnsupportedError] if the process is | 113 * Throws an [UnsupportedError] if the process is |
110 * non-interactive. | 114 * non-interactive. |
111 */ | 115 */ |
112 void set onExit(void callback(int exitCode)); | 116 void set onExit(void callback(int exitCode)); |
113 | 117 |
114 /** | 118 /** |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 /** | 263 /** |
260 * Contains the system message for the process exception if any. | 264 * Contains the system message for the process exception if any. |
261 */ | 265 */ |
262 final String message; | 266 final String message; |
263 | 267 |
264 /** | 268 /** |
265 * Contains the OS error code for the process exception if any. | 269 * Contains the OS error code for the process exception if any. |
266 */ | 270 */ |
267 final int errorCode; | 271 final int errorCode; |
268 } | 272 } |
OLD | NEW |