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

Unified Diff: runtime/bin/process_patch.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 | « runtime/bin/process.cc ('k') | sdk/lib/_internal/compiler/js_lib/io_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_patch.dart
diff --git a/runtime/bin/process_patch.dart b/runtime/bin/process_patch.dart
index d1883818d11b115b0f2520cb4e7302024300432d..5a6dc55f5d71614716c4eb133f749c360f6b1bc3 100644
--- a/runtime/bin/process_patch.dart
+++ b/runtime/bin/process_patch.dart
@@ -70,6 +70,15 @@ patch class Process {
stdoutEncoding,
stderrEncoding);
}
+
+ /* patch */ static bool killPid(
+ int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
+ if (signal is! ProcessSignal) {
+ throw new ArgumentError(
+ "Argument 'signal' must be a ProcessSignal");
+ }
+ return _ProcessUtils._killPid(pid, signal._signalNumber);
+ }
}
@@ -132,6 +141,8 @@ patch class _ProcessUtils {
/* patch */ static int _getExitCode() native "Process_GetExitCode";
/* patch */ static void _sleep(int millis) native "Process_Sleep";
/* patch */ static int _pid(Process process) native "Process_Pid";
+ static int _killPid(int pid, ProcessSignal signal)
+ native "Process_KillPid";
/* patch */ static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) {
if (signal != ProcessSignal.SIGHUP &&
signal != ProcessSignal.SIGINT &&
@@ -518,11 +529,9 @@ class _ProcessImpl extends _ProcessImplNativeWrapper with _ServiceObject
}
assert(_started);
if (_ended) return false;
- return _kill(this, signal._signalNumber);
+ return _ProcessUtils._killPid(pid, signal._signalNumber);
}
- bool _kill(Process p, int signal) native "Process_Kill";
-
int get pid => _ProcessUtils._pid(this);
String _path;
« no previous file with comments | « runtime/bin/process.cc ('k') | sdk/lib/_internal/compiler/js_lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698