Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2006-04-27 16:22:05 +0000
committerMarkus Schorn2006-04-27 16:22:05 +0000
commita8376d0bb870d0d1bc8a816daf044bbe7ddf6840 (patch)
tree6f4faa30e901621dfa8920dccf4651f29969bc32 /core
parent258e48d54796ed6f042ac95207fddf9a08b3c59a (diff)
downloadorg.eclipse.cdt-a8376d0bb870d0d1bc8a816daf044bbe7ddf6840.tar.gz
org.eclipse.cdt-a8376d0bb870d0d1bc8a816daf044bbe7ddf6840.tar.xz
org.eclipse.cdt-a8376d0bb870d0d1bc8a816daf044bbe7ddf6840.zip
Let spawner kill subprocesses, bug 119387.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.linux/library/exec_pty.c3
-rw-r--r--core/org.eclipse.cdt.core.linux/library/exec_unix.c3
-rw-r--r--core/org.eclipse.cdt.core.linux/library/spawner.c26
3 files changed, 27 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core.linux/library/exec_pty.c b/core/org.eclipse.cdt.core.linux/library/exec_pty.c
index 9e484902a07..0c2c8c98fe3 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec_pty.c
+++ b/core/org.eclipse.cdt.core.linux/library/exec_pty.c
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
*******************************************************************************/
#include "exec0.h"
#include <unistd.h>
@@ -93,6 +94,8 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
close(fd++);
}
+ setpgid(getpid(), getpid());
+
if (envp[0] == NULL) {
execv(full_path, argv);
} else {
diff --git a/core/org.eclipse.cdt.core.linux/library/exec_unix.c b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
index eb53945b89f..912b17ac278 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec_unix.c
+++ b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
*******************************************************************************/
#include "exec0.h"
#include <unistd.h>
@@ -90,6 +91,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
close(fd++);
}
+ setpgid(getpid(), getpid());
+
if (envp[0] == NULL) {
execv(full_path, argv);
} else {
diff --git a/core/org.eclipse.cdt.core.linux/library/spawner.c b/core/org.eclipse.cdt.core.linux/library/spawner.c
index 21a9181e98e..2e9e1183a04 100644
--- a/core/org.eclipse.cdt.core.linux/library/spawner.c
+++ b/core/org.eclipse.cdt.core.linux/library/spawner.c
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
*******************************************************************************/
#include <unistd.h>
#include <stdlib.h>
@@ -247,23 +248,38 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
switch (sig) {
case 0: /* NOOP */
- status = kill(pid, 0);
+ status = killpg(pid, 0);
+ if(status == -1) {
+ status = kill(pid, 0);
+ }
break;
case 2: /* INTERRUPT */
- status = kill(pid, SIGINT);
+ status = killpg(pid, SIGINT);
+ if(status == -1) {
+ status = kill(pid, SIGINT);
+ }
break;
case 9: /* KILL */
- status = kill(pid, SIGKILL);
+ status = killpg(pid, SIGKILL);
+ if(status == -1) {
+ status = kill(pid, SIGKILL);
+ }
break;
case 15: /* TERM */
- status = kill(pid, SIGTERM);
+ status = killpg(pid, SIGTERM);
+ if(status == -1) {
+ status = kill(pid, SIGTERM);
+ }
break;
default:
- status = kill(pid, sig); /* WHAT ?? */
+ status = killpg(pid, sig); /* WHAT ?? */
+ if(status == -1) {
+ status = kill(pid, sig); /* WHAT ?? */
+ }
break;
}

Back to the top