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

Let spawner kill subprocesses, bug 119387

This commit is contained in:
Markus Schorn 2006-04-28 08:33:43 +00:00
parent 17fe1a203d
commit 4cc10e41b6
7 changed files with 479 additions and 457 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>
@ -95,6 +96,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;
}