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

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: Changes based on ager's review. 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..f8df35d97e435ac098ae68e372c0847475470bbf 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;
Søren Gjesse 2012/06/12 10:22:25 Maybe this should be named _ended now.
Anders Johnsen 2012/06/12 12:00:13 Done.
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 'signal' must be a ProcessSignal");
+ }
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