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

Unified 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: Addressed review comments Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/io_patch.dart ('k') | tests/standalone/io/process_kill_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/process.dart
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index a977b319b6173dd8bfe70d0cf62bfb952217c7ad..4860267a61920181b4261bd5e70647b8c44ff8e5 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -346,6 +346,25 @@ abstract class Process {
Encoding stderrEncoding: SYSTEM_ENCODING});
/**
+ * Kills the process with id [pid].
+ *
+ * Where possible, sends the [signal] to the process with id
+ * `pid`. This includes Linux and OS X. The default signal is
+ * [ProcessSignal.SIGTERM] which will normally terminate the
+ * process.
+ *
+ * On platforms without signal support, including Windows, the call
+ * just terminates the process with id `pid` in a platform specific
+ * way, and the `signal` parameter is ignored.
+ *
+ * Returns `true` if the signal is successfully delivered to the
+ * process. Otherwise the signal could not be sent, usually meaning
+ * that the process is already dead.
+ */
+ external static bool killPid(
+ int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]);
+
+ /**
* Returns the standard output stream of the process as a [:Stream:].
*/
Stream<List<int>> get stdout;
@@ -366,15 +385,19 @@ abstract class Process {
int get pid;
/**
- * On Linux and Mac OS, [kill] sends [signal] to the process. When the process
- * terminates as a result of calling [kill], the value for [exitCode] may be a
- * negative number corresponding to the provided [signal].
+ * Kills the process.
+ *
+ * Where possible, sends the [signal] to the process. This includes
+ * Linux and OS X. The default signal is [ProcessSignal.SIGTERM]
+ * which will normally terminate the process.
*
- * On Windows, [kill] kills the process, ignoring the [signal] flag.
+ * On platforms without signal support, including Windows, the call
+ * just terminates the process in a platform specific way, and the
+ * `signal` parameter is ignored.
*
- * Returns [:true:] if the signal is successfully sent and process is killed.
- * Otherwise the signal could not be sent, usually meaning that the process is
- * already dead.
+ * Returns `true` if the signal is successfully delivered to the
+ * process. Otherwise the signal could not be sent, usually meaning
+ * that the process is already dead.
*/
bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/io_patch.dart ('k') | tests/standalone/io/process_kill_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698