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

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

Issue 1068803002: Make the construction of a ProcessResult public (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « runtime/bin/process_patch.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);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 * Returns `true` if the signal is successfully delivered to the 424 * Returns `true` if the signal is successfully delivered to the
425 * process. Otherwise the signal could not be sent, usually meaning 425 * process. Otherwise the signal could not be sent, usually meaning
426 * that the process is already dead. 426 * that the process is already dead.
427 */ 427 */
428 bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]); 428 bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
429 } 429 }
430 430
431 431
432 /** 432 /**
433 * [ProcessResult] represents the result of running a non-interactive 433 * [ProcessResult] represents the result of running a non-interactive
434 * process started with [:Process.run:]. 434 * process started with [:Process.run:].
Lasse Reichstein Nielsen 2015/04/07 12:38:44 [:Process.run:] -> [Process.run] or [Process.runSy
Søren Gjesse 2015/04/07 13:05:35 Done.
435 */ 435 */
436 abstract class ProcessResult { 436 class ProcessResult {
437 /** 437 /**
438 * Exit code for the process. 438 * Exit code for the process.
439 * 439 *
440 * See [Process.exitCode] for more information in the exit code 440 * See [Process.exitCode] for more information in the exit code
441 * value. 441 * value.
442 */ 442 */
443 int get exitCode; 443 final int exitCode;
444 444
445 /** 445 /**
446 * Standard output from the process. The value used for the 446 * Standard output from the process. The value used for the
447 * `stdoutEncoding` argument to `Process.run` determines the type. If 447 * `stdoutEncoding` argument to `Process.run` determines the type. If
448 * `null` was used this value is of type `List<int> otherwise it is 448 * `null` was used this value is of type `List<int> otherwise it is
449 * of type `String`. 449 * of type `String`.
Lasse Reichstein Nielsen 2015/04/07 12:38:45 Make ProcessResult generic with the type of this a
Søren Gjesse 2015/04/07 13:05:35 One can specify different encodings for stdout and
450 */ 450 */
451 get stdout; 451 final stdout;
452 452
453 /** 453 /**
454 * Standard error from the process. The value used for the 454 * Standard error from the process. The value used for the
455 * `stderrEncoding` argument to `Process.run` determines the type. If 455 * `stderrEncoding` argument to `Process.run` determines the type. If
456 * `null` was used this value is of type `List<int> 456 * `null` was used this value is of type `List<int>
457 * otherwise it is of type `String`. 457 * otherwise it is of type `String`.
458 */ 458 */
459 get stderr; 459 final stderr;
460 460
461 /** 461 /**
462 * Process id from the process. 462 * Process id from the process.
Lasse Reichstein Nielsen 2015/04/07 12:38:44 Process id of the process ?
Søren Gjesse 2015/04/07 13:05:35 Done.
463 */ 463 */
464 int get pid; 464 final int pid;
465
466 /**
467 * Construct an instance of [ProcessResult].
468 *
469 * The main use of `ProcessResult is as return value from
470 * `Process.run` and `Process.runSync`. However for some applications
Lasse Reichstein Nielsen 2015/04/07 12:38:44 Comma after "however". Maybe rewrite to something
Søren Gjesse 2015/04/07 13:05:35 I removed the comment.
471 * constructing it directly might be useful.
472 */
473 const ProcessResult(int this.pid,
Lasse Reichstein Nielsen 2015/04/07 12:38:44 Remove the `const` if possible. It makes little-to
Søren Gjesse 2015/04/07 13:05:35 Done.
474 int this.exitCode,
475 this.stdout,
476 this.stderr);
465 } 477 }
466 478
467 479
468 /** 480 /**
469 * On Posix systems, [ProcessSignal] is used to send a specific signal 481 * On Posix systems, [ProcessSignal] is used to send a specific signal
470 * to a child process, see [:Process.kill:]. 482 * to a child process, see [:Process.kill:].
471 * 483 *
472 * Some [ProcessSignal]s can also be watched, as a way to intercept the default 484 * Some [ProcessSignal]s can also be watched, as a way to intercept the default
473 * signal handler and implement another. See [ProcessSignal.watch] for more 485 * signal handler and implement another. See [ProcessSignal.watch] for more
474 * information. 486 * information.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 final int errorCode; 582 final int errorCode;
571 583
572 const ProcessException(this.executable, this.arguments, [this.message = "", 584 const ProcessException(this.executable, this.arguments, [this.message = "",
573 this.errorCode = 0]); 585 this.errorCode = 0]);
574 String toString() { 586 String toString() {
575 var msg = (message == null) ? 'OS error code: $errorCode' : message; 587 var msg = (message == null) ? 'OS error code: $errorCode' : message;
576 var args = arguments.join(' '); 588 var args = arguments.join(' ');
577 return "ProcessException: $msg\n Command: $executable $args"; 589 return "ProcessException: $msg\n Command: $executable $args";
578 } 590 }
579 } 591 }
OLDNEW
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698