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

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

Issue 895623002: Add support for killing a process with a given PID to dart:io (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
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 String executable, 339 String executable,
340 List<String> arguments, 340 List<String> arguments,
341 {String workingDirectory, 341 {String workingDirectory,
342 Map<String, String> environment, 342 Map<String, String> environment,
343 bool includeParentEnvironment: true, 343 bool includeParentEnvironment: true,
344 bool runInShell: false, 344 bool runInShell: false,
345 Encoding stdoutEncoding: SYSTEM_ENCODING, 345 Encoding stdoutEncoding: SYSTEM_ENCODING,
346 Encoding stderrEncoding: SYSTEM_ENCODING}); 346 Encoding stderrEncoding: SYSTEM_ENCODING});
347 347
348 /** 348 /**
349 * On Linux and Mac OS, [killPid] sends [signal] to the process with
Lasse Reichstein Nielsen 2015/02/03 14:00:47 Is it officially called Mac OS? Or is it just OS X
Søren Gjesse 2015/02/04 08:16:02 You are right. We are currently using Mac OS in th
350 * process id [pid].
351 *
352 * On Windows, `killPid` kills the process with process `pid` , ignoring the
353 * `signal` flag.
Lasse Reichstein Nielsen 2015/02/03 14:00:47 Start with a single statement describing the opera
Søren Gjesse 2015/02/04 08:16:02 Thanks, rewritten. The signals you can receive on
354 *
355 * Returns `true` if the signal is successfully sent and process is killed.
Lasse Reichstein Nielsen 2015/02/03 14:00:47 and process -> and the process What if the proces
Søren Gjesse 2015/02/04 08:16:02 You are right. We can only see if the signal was s
356 * Otherwise the signal could not be sent, usually meaning that the process is
357 * already dead.
358 */
359 external static bool killPid(
360 int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]);
361
362 /**
349 * Returns the standard output stream of the process as a [:Stream:]. 363 * Returns the standard output stream of the process as a [:Stream:].
350 */ 364 */
351 Stream<List<int>> get stdout; 365 Stream<List<int>> get stdout;
352 366
353 /** 367 /**
354 * Returns the standard error stream of the process as a [:Stream:]. 368 * Returns the standard error stream of the process as a [:Stream:].
355 */ 369 */
356 Stream<List<int>> get stderr; 370 Stream<List<int>> get stderr;
357 371
358 /** 372 /**
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 final int errorCode; 535 final int errorCode;
522 536
523 const ProcessException(this.executable, this.arguments, [this.message = "", 537 const ProcessException(this.executable, this.arguments, [this.message = "",
524 this.errorCode = 0]); 538 this.errorCode = 0]);
525 String toString() { 539 String toString() {
526 var msg = (message == null) ? 'OS error code: $errorCode' : message; 540 var msg = (message == null) ? 'OS error code: $errorCode' : message;
527 var args = arguments.join(' '); 541 var args = arguments.join(' ');
528 return "ProcessException: $msg\n Command: $executable $args"; 542 return "ProcessException: $msg\n Command: $executable $args";
529 } 543 }
530 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698