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

Unified Diff: runtime/bin/process_impl.dart

Issue 10545134: Give Process.kill an optional argument to specify which signal to send. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
Index: runtime/bin/process_impl.dart
diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_impl.dart
index bdb5d6aca4a070ea538663d47eda8f873898091d..0bed8cc2a23149ea5e18c75c2a9bc4a3f0a54e4a 100644
--- a/runtime/bin/process_impl.dart
+++ b/runtime/bin/process_impl.dart
@@ -178,6 +178,7 @@ class _Process extends Process {
}
void handleExit() {
+ _killed = true;
if (_onExit !== null) {
_onExit(exitCode(exitDataBuffer));
}
@@ -224,7 +225,11 @@ class _Process extends Process {
return _out.outputStream;
}
- void kill() {
+ void kill([ProcessSignal signal = ProcessSignal.SIGTERM]) {
+ if (signal is! ProcessSignal) {
+ throw new IllegalArgumentException(
+ "Argument 'force' must be a ProcessSignal");
Mads Ager (google) 2012/06/12 09:13:44 'force' -> 'signal'
Anders Johnsen 2012/06/12 09:21:04 Done.
+ }
if (_closed && _pid === null) {
_reportError(new ProcessException("Process closed"));
return;
@@ -233,15 +238,14 @@ class _Process extends Process {
return;
}
// TODO(ager): Make the actual kill operation asynchronous.
- if (_kill(_pid)) {
- _killed = true;
+ if (_kill(_pid, signal._signalNumber)) {
return;
}
_reportError(new ProcessException("Could not kill process"));
return;
}
- void _kill(int pid) native "Process_Kill";
+ void _kill(int pid, int signal) native "Process_Kill";
void close() {
if (_closed) {

Powered by Google App Engine
This is Rietveld 408576698