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

Side by Side Diff: sdk/lib/io/process.dart

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix ddbg. Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 void _exit(int status); 10 external static void _exit(int status);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 * If [includeParentEnvironment] is `true`, the process's environment will 122 * If [includeParentEnvironment] is `true`, the process's environment will
123 * include the parent process's environment, with [environment] taking 123 * include the parent process's environment, with [environment] taking
124 * precedence. Default is `true`. 124 * precedence. Default is `true`.
125 * 125 *
126 * If [runInShell] is true, the process will be spawned through a system 126 * If [runInShell] is true, the process will be spawned through a system
127 * shell. On Linux and Mac OS, `/bin/sh` is used, while 127 * shell. On Linux and Mac OS, `/bin/sh` is used, while
128 * `%WINDIR%\system32\cmd.exe` is used on Windows. 128 * `%WINDIR%\system32\cmd.exe` is used on Windows.
129 * 129 *
130 * The encoding used for decoding `stdout` and `stderr` into text is 130 * The encoding used for decoding `stdout` and `stderr` into text is
131 * controlled through [stdoutEncoding] and [stderrEncoding]. The 131 * controlled through [stdoutEncoding] and [stderrEncoding]. The
132 * default encoding is `Encoding.SYSTEM`. If `null` is used no 132 * default encoding is [SYSTEM_ENCODING]. If `null` is used no
133 * decoding will happen and the [ProcessResult] will hold binary 133 * decoding will happen and the [ProcessResult] will hold binary
134 * data. 134 * data.
135 * 135 *
136 * Returns a `Future<ProcessResult>` that completes with the 136 * Returns a `Future<ProcessResult>` that completes with the
137 * result of running the process, i.e., exit code, standard out and 137 * result of running the process, i.e., exit code, standard out and
138 * standard in. 138 * standard in.
139 */ 139 */
140 external static Future<ProcessResult> run( 140 external static Future<ProcessResult> run(
141 String executable, 141 String executable,
142 List<String> arguments, 142 List<String> arguments,
143 {String workingDirectory, 143 {String workingDirectory,
144 Map<String, String> environment, 144 Map<String, String> environment,
145 bool includeParentEnvironment: true, 145 bool includeParentEnvironment: true,
146 bool runInShell: false, 146 bool runInShell: false,
147 Encoding stdoutEncoding: Encoding.SYSTEM, 147 Encoding stdoutEncoding: SYSTEM_ENCODING,
148 Encoding stderrEncoding: Encoding.SYSTEM}); 148 Encoding stderrEncoding: SYSTEM_ENCODING});
149 149
150 150
151 /** 151 /**
152 * Starts a process and runs it to completion. This is a synchronous 152 * Starts a process and runs it to completion. This is a synchronous
153 * call and will block until the child process terminates. 153 * call and will block until the child process terminates.
154 * 154 *
155 * The arguments are the same as for `Process.run`. 155 * The arguments are the same as for `Process.run`.
156 * 156 *
157 * Returns a `ProcessResult` with the result of running the process, 157 * Returns a `ProcessResult` with the result of running the process,
158 * i.e., exit code, standard out and standard in. 158 * i.e., exit code, standard out and standard in.
159 */ 159 */
160 external static ProcessResult runSync( 160 external static ProcessResult runSync(
161 String executable, 161 String executable,
162 List<String> arguments, 162 List<String> arguments,
163 {String workingDirectory, 163 {String workingDirectory,
164 Map<String, String> environment, 164 Map<String, String> environment,
165 bool includeParentEnvironment: true, 165 bool includeParentEnvironment: true,
166 bool runInShell: false, 166 bool runInShell: false,
167 Encoding stdoutEncoding: Encoding.SYSTEM, 167 Encoding stdoutEncoding: SYSTEM_ENCODING,
168 Encoding stderrEncoding: Encoding.SYSTEM}); 168 Encoding stderrEncoding: SYSTEM_ENCODING});
169 169
170 /** 170 /**
171 * Returns the standard output stream of the process as a [:Stream:]. 171 * Returns the standard output stream of the process as a [:Stream:].
172 * 172 *
173 * Throws an [UnsupportedError] if the process is 173 * Throws an [UnsupportedError] if the process is
174 * non-interactive. 174 * non-interactive.
175 */ 175 */
176 Stream<List<int>> get stdout; 176 Stream<List<int>> get stdout;
177 177
178 /** 178 /**
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 /** 318 /**
319 * Contains the system message for the process exception if any. 319 * Contains the system message for the process exception if any.
320 */ 320 */
321 final String message; 321 final String message;
322 322
323 /** 323 /**
324 * Contains the OS error code for the process exception if any. 324 * Contains the OS error code for the process exception if any.
325 */ 325 */
326 final int errorCode; 326 final int errorCode;
327 } 327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698