1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Let spawner kill subprocesses, bug 119387.

This commit is contained in:
Markus Schorn 2006-04-27 16:22:05 +00:00
parent 258e48d547
commit a8376d0bb8
3 changed files with 27 additions and 5 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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 = killpg(pid, 0);
if(status == -1) {
status = kill(pid, 0);
}
break;
case 2: /* INTERRUPT */
status = killpg(pid, SIGINT);
if(status == -1) {
status = kill(pid, SIGINT);
}
break;
case 9: /* KILL */
status = killpg(pid, SIGKILL);
if(status == -1) {
status = kill(pid, SIGKILL);
}
break;
case 15: /* TERM */
status = killpg(pid, SIGTERM);
if(status == -1) {
status = kill(pid, SIGTERM);
}
break;
default:
status = killpg(pid, sig); /* WHAT ?? */
if(status == -1) {
status = kill(pid, sig); /* WHAT ?? */
}
break;
}