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

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

Issue 77893003: Documentation update (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « sdk/lib/io/http.dart ('k') | no next file » | 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) 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 * precedence. Default is `true`. 88 * precedence. Default is `true`.
89 * 89 *
90 * If [runInShell] is true, the process will be spawned through a system 90 * If [runInShell] is true, the process will be spawned through a system
91 * shell. On Linux and Mac OS, [:/bin/sh:] is used, while 91 * shell. On Linux and Mac OS, [:/bin/sh:] is used, while
92 * [:%WINDIR%\system32\cmd.exe:] is used on Windows. 92 * [:%WINDIR%\system32\cmd.exe:] is used on Windows.
93 * 93 *
94 * Users must read all data coming on the [stdout] and [stderr] 94 * Users must read all data coming on the [stdout] and [stderr]
95 * streams of processes started with [:Process.start:]. If the user 95 * streams of processes started with [:Process.start:]. If the user
96 * does not read all data on the streams the underlying system 96 * does not read all data on the streams the underlying system
97 * resources will not be freed since there is still pending data. 97 * resources will not be freed since there is still pending data.
98 *
99 * The following code uses `Process.start` to grep for `main` in the
100 * file `test.dart` on Linux.
101 *
102 * Process.start('grep', ['-i', 'main', 'test.dart']).then((p) {
103 * p.stdout.pipe(stdout);
Anders Johnsen 2013/11/20 12:24:04 Please use `stdout.addStream(p.stdout)` and likewi
Søren Gjesse 2014/01/02 09:19:30 Done.
104 * p.stderr.pipe(stderr);
105 * });
98 */ 106 */
99 external static Future<Process> start( 107 external static Future<Process> start(
100 String executable, 108 String executable,
101 List<String> arguments, 109 List<String> arguments,
102 {String workingDirectory, 110 {String workingDirectory,
103 Map<String, String> environment, 111 Map<String, String> environment,
104 bool includeParentEnvironment: true, 112 bool includeParentEnvironment: true,
105 bool runInShell: false}); 113 bool runInShell: false});
106 114
107 /** 115 /**
(...skipping 21 matching lines...) Expand all
129 * 137 *
130 * The encoding used for decoding `stdout` and `stderr` into text is 138 * The encoding used for decoding `stdout` and `stderr` into text is
131 * controlled through [stdoutEncoding] and [stderrEncoding]. The 139 * controlled through [stdoutEncoding] and [stderrEncoding]. The
132 * default encoding is [SYSTEM_ENCODING]. If `null` is used no 140 * default encoding is [SYSTEM_ENCODING]. If `null` is used no
133 * decoding will happen and the [ProcessResult] will hold binary 141 * decoding will happen and the [ProcessResult] will hold binary
134 * data. 142 * data.
135 * 143 *
136 * Returns a `Future<ProcessResult>` that completes with the 144 * Returns a `Future<ProcessResult>` that completes with the
137 * result of running the process, i.e., exit code, standard out and 145 * result of running the process, i.e., exit code, standard out and
138 * standard in. 146 * standard in.
147 *
148 * The following code uses `Process.run` to grep for `main` in the
149 * file `test.dart` on Linux.
150 *
151 * Process.run('grep', ['-i', 'main', 'test.dart']).then((result) {
152 * stdout.write(result.stdout);
153 * stdout.write(result.stderr);
Anders Johnsen 2013/11/20 12:24:04 stderr.write
Søren Gjesse 2014/01/02 09:19:30 Done.
154 * });
139 */ 155 */
140 external static Future<ProcessResult> run( 156 external static Future<ProcessResult> run(
141 String executable, 157 String executable,
142 List<String> arguments, 158 List<String> arguments,
143 {String workingDirectory, 159 {String workingDirectory,
144 Map<String, String> environment, 160 Map<String, String> environment,
145 bool includeParentEnvironment: true, 161 bool includeParentEnvironment: true,
146 bool runInShell: false, 162 bool runInShell: false,
147 Encoding stdoutEncoding: SYSTEM_ENCODING, 163 Encoding stdoutEncoding: SYSTEM_ENCODING,
148 Encoding stderrEncoding: SYSTEM_ENCODING}); 164 Encoding stderrEncoding: SYSTEM_ENCODING});
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 /** 334 /**
319 * Contains the system message for the process exception if any. 335 * Contains the system message for the process exception if any.
320 */ 336 */
321 final String message; 337 final String message;
322 338
323 /** 339 /**
324 * Contains the OS error code for the process exception if any. 340 * Contains the OS error code for the process exception if any.
325 */ 341 */
326 final int errorCode; 342 final int errorCode;
327 } 343 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698