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

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

Issue 901513002: Change Mac OS to OS X in dart:io dartdoc (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « sdk/lib/io/platform.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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);
11 external static void _setExitCode(int status); 11 external static void _setExitCode(int status);
12 external static int _getExitCode(); 12 external static int _getExitCode();
13 external static void _sleep(int millis); 13 external static void _sleep(int millis);
14 external static int _pid(Process process); 14 external static int _pid(Process process);
15 external static Stream<ProcessSignal> _watchSignal(ProcessSignal signal); 15 external static Stream<ProcessSignal> _watchSignal(ProcessSignal signal);
16 } 16 }
17 17
18 /** 18 /**
19 * Exit the Dart VM process immediately with the given exit code. 19 * Exit the Dart VM process immediately with the given exit code.
20 * 20 *
21 * This does not wait for any asynchronous operations to terminate. Using 21 * This does not wait for any asynchronous operations to terminate. Using
22 * [exit] is therefore very likely to lose data. 22 * [exit] is therefore very likely to lose data.
23 * 23 *
24 * The handling of exit codes is platform specific. 24 * The handling of exit codes is platform specific.
25 * 25 *
26 * On Linux and Mac OS an exit code for normal termination will always 26 * On Linux and OS X an exit code for normal termination will always
27 * be in the range [0..255]. If an exit code outside this range is 27 * be in the range [0..255]. If an exit code outside this range is
28 * set the actual exit code will be the lower 8 bits masked off and 28 * set the actual exit code will be the lower 8 bits masked off and
29 * treated as an unsigned value. E.g. using an exit code of -1 will 29 * treated as an unsigned value. E.g. using an exit code of -1 will
30 * result in an actual exit code of 255 being reported. 30 * result in an actual exit code of 255 being reported.
31 * 31 *
32 * On Windows the exit code can be set to any 32-bit value. However 32 * On Windows the exit code can be set to any 32-bit value. However
33 * some of these values are reserved for reporting system errors like 33 * some of these values are reserved for reporting system errors like
34 * crashes. 34 * crashes.
35 * 35 *
36 * Besides this the Dart executable itself uses an exit code of `254` 36 * Besides this the Dart executable itself uses an exit code of `254`
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * provides additional task-oriented code samples that show how to use 205 * provides additional task-oriented code samples that show how to use
206 * various API from the [dart:io] library. 206 * various API from the [dart:io] library.
207 */ 207 */
208 abstract class Process { 208 abstract class Process {
209 /** 209 /**
210 * Returns a [:Future:] which completes with the exit code of the process 210 * Returns a [:Future:] which completes with the exit code of the process
211 * when the process completes. 211 * when the process completes.
212 * 212 *
213 * The handling of exit codes is platform specific. 213 * The handling of exit codes is platform specific.
214 * 214 *
215 * On Linux and Mac a normal exit code will be a positive value in 215 * On Linux and OS X a normal exit code will be a positive value in
216 * the range [0..255]. If the process was terminated due to a signal 216 * the range [0..255]. If the process was terminated due to a signal
217 * the exit code will be a negative value in the range [-255..-1], 217 * the exit code will be a negative value in the range [-255..-1],
218 * where the absolute value of the exit code is the signal 218 * where the absolute value of the exit code is the signal
219 * number. For example, if a process crashes due to a segmentation 219 * number. For example, if a process crashes due to a segmentation
220 * violation the exit code will be -11, as the signal SIGSEGV has the 220 * violation the exit code will be -11, as the signal SIGSEGV has the
221 * number 11. 221 * number 11.
222 * 222 *
223 * On Windows a process can report any 32-bit value as an exit 223 * On Windows a process can report any 32-bit value as an exit
224 * code. When returning the exit code this exit code is turned into 224 * code. When returning the exit code this exit code is turned into
225 * a signed value. Some special values are used to report 225 * a signed value. Some special values are used to report
(...skipping 22 matching lines...) Expand all
248 * set the environment of the parent process is inherited. Currently, only 248 * set the environment of the parent process is inherited. Currently, only
249 * US-ASCII environment variables are supported and errors are likely to occur 249 * US-ASCII environment variables are supported and errors are likely to occur
250 * if an environment variable with code-points outside the US-ASCII range is 250 * if an environment variable with code-points outside the US-ASCII range is
251 * passed in. 251 * passed in.
252 * 252 *
253 * If [includeParentEnvironment] is `true`, the process's environment will 253 * If [includeParentEnvironment] is `true`, the process's environment will
254 * include the parent process's environment, with [environment] taking 254 * include the parent process's environment, with [environment] taking
255 * precedence. Default is `true`. 255 * precedence. Default is `true`.
256 * 256 *
257 * If [runInShell] is `true`, the process will be spawned through a system 257 * If [runInShell] is `true`, the process will be spawned through a system
258 * shell. On Linux and Mac OS, [:/bin/sh:] is used, while 258 * shell. On Linux and OS X, [:/bin/sh:] is used, while
259 * [:%WINDIR%\system32\cmd.exe:] is used on Windows. 259 * [:%WINDIR%\system32\cmd.exe:] is used on Windows.
260 * 260 *
261 * Users must read all data coming on the [stdout] and [stderr] 261 * Users must read all data coming on the [stdout] and [stderr]
262 * streams of processes started with [:Process.start:]. If the user 262 * streams of processes started with [:Process.start:]. If the user
263 * does not read all data on the streams the underlying system 263 * does not read all data on the streams the underlying system
264 * resources will not be released since there is still pending data. 264 * resources will not be released since there is still pending data.
265 * 265 *
266 * The following code uses `Process.start` to grep for `main` in the 266 * The following code uses `Process.start` to grep for `main` in the
267 * file `test.dart` on Linux. 267 * file `test.dart` on Linux.
268 * 268 *
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 * set the environment of the parent process is inherited. Currently, only 313 * set the environment of the parent process is inherited. Currently, only
314 * US-ASCII environment variables are supported and errors are likely to occur 314 * US-ASCII environment variables are supported and errors are likely to occur
315 * if an environment variable with code-points outside the US-ASCII range is 315 * if an environment variable with code-points outside the US-ASCII range is
316 * passed in. 316 * passed in.
317 * 317 *
318 * If [includeParentEnvironment] is `true`, the process's environment will 318 * If [includeParentEnvironment] is `true`, the process's environment will
319 * include the parent process's environment, with [environment] taking 319 * include the parent process's environment, with [environment] taking
320 * precedence. Default is `true`. 320 * precedence. Default is `true`.
321 * 321 *
322 * If [runInShell] is true, the process will be spawned through a system 322 * If [runInShell] is true, the process will be spawned through a system
323 * shell. On Linux and Mac OS, `/bin/sh` is used, while 323 * shell. On Linux and OS X, `/bin/sh` is used, while
324 * `%WINDIR%\system32\cmd.exe` is used on Windows. 324 * `%WINDIR%\system32\cmd.exe` is used on Windows.
325 * 325 *
326 * The encoding used for decoding `stdout` and `stderr` into text is 326 * The encoding used for decoding `stdout` and `stderr` into text is
327 * controlled through [stdoutEncoding] and [stderrEncoding]. The 327 * controlled through [stdoutEncoding] and [stderrEncoding]. The
328 * default encoding is [SYSTEM_ENCODING]. If `null` is used no 328 * default encoding is [SYSTEM_ENCODING]. If `null` is used no
329 * decoding will happen and the [ProcessResult] will hold binary 329 * decoding will happen and the [ProcessResult] will hold binary
330 * data. 330 * data.
331 * 331 *
332 * Returns a `Future<ProcessResult>` that completes with the 332 * Returns a `Future<ProcessResult>` that completes with the
333 * result of running the process, i.e., exit code, standard out and 333 * result of running the process, i.e., exit code, standard out and
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 final int errorCode; 570 final int errorCode;
571 571
572 const ProcessException(this.executable, this.arguments, [this.message = "", 572 const ProcessException(this.executable, this.arguments, [this.message = "",
573 this.errorCode = 0]); 573 this.errorCode = 0]);
574 String toString() { 574 String toString() {
575 var msg = (message == null) ? 'OS error code: $errorCode' : message; 575 var msg = (message == null) ? 'OS error code: $errorCode' : message;
576 var args = arguments.join(' '); 576 var args = arguments.join(' ');
577 return "ProcessException: $msg\n Command: $executable $args"; 577 return "ProcessException: $msg\n Command: $executable $args";
578 } 578 }
579 } 579 }
OLDNEW
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698