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

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

Issue 21816002: Add Process.runSync for running processe synchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed Mac OS issue 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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: Encoding.SYSTEM,
148 Encoding stderrEncoding: Encoding.SYSTEM}); 148 Encoding stderrEncoding: Encoding.SYSTEM});
149 149
150
151 /**
152 * Starts a process and runs it to completion. This is a synchronous
153 * call and will block until the child process terminates.
154 *
155 * The arguments are the same as for `Process.run`.
156 *
157 * Returns a `ProcessResult` with the result of running the process,
158 * i.e., exit code, standard out and standard in.
159 */
160 external static ProcessResult runSync(
161 String executable,
162 List<String> arguments,
163 {String workingDirectory,
164 Map<String, String> environment,
165 bool includeParentEnvironment: true,
166 bool runInShell: false,
167 Encoding stdoutEncoding: Encoding.SYSTEM,
168 Encoding stderrEncoding: Encoding.SYSTEM});
169
150 /** 170 /**
151 * Returns the standard output stream of the process as a [:Stream:]. 171 * Returns the standard output stream of the process as a [:Stream:].
152 * 172 *
153 * Throws an [UnsupportedError] if the process is 173 * Throws an [UnsupportedError] if the process is
154 * non-interactive. 174 * non-interactive.
155 */ 175 */
156 Stream<List<int>> get stdout; 176 Stream<List<int>> get stdout;
157 177
158 /** 178 /**
159 * Returns the standard error stream of the process as a [:Stream:]. 179 * Returns the standard error stream of the process as a [:Stream:].
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 /** 318 /**
299 * Contains the system message for the process exception if any. 319 * Contains the system message for the process exception if any.
300 */ 320 */
301 final String message; 321 final String message;
302 322
303 /** 323 /**
304 * Contains the OS error code for the process exception if any. 324 * Contains the OS error code for the process exception if any.
305 */ 325 */
306 final int errorCode; 326 final int errorCode;
307 } 327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698