mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Let spawner kill subprocesses, bug 119387
This commit is contained in:
parent
17fe1a203d
commit
4cc10e41b6
7 changed files with 479 additions and 457 deletions
Binary file not shown.
Binary file not shown.
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
|
* Wind River Systems, Inc.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -95,6 +96,8 @@ exec_pty(const char *path, char *const argv[], char *const envp[],
|
||||||
close(fd++);
|
close(fd++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setpgid(getpid(), getpid());
|
||||||
|
|
||||||
if (envp[0] == NULL) {
|
if (envp[0] == NULL) {
|
||||||
execv(full_path, argv);
|
execv(full_path, argv);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
|
* Wind River Systems, Inc.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
#include "exec0.h"
|
#include "exec0.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -90,6 +91,8 @@ exec0(const char *path, char *const argv[], char *const envp[],
|
||||||
close(fd++);
|
close(fd++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setpgid(getpid(), getpid());
|
||||||
|
|
||||||
if (envp[0] == NULL) {
|
if (envp[0] == NULL) {
|
||||||
execv(full_path, argv);
|
execv(full_path, argv);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
|
* Wind River Systems, Inc.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -247,23 +248,38 @@ Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case 0: /* NOOP */
|
case 0: /* NOOP */
|
||||||
|
status = killpg(pid, 0);
|
||||||
|
if(status == -1) {
|
||||||
status = kill(pid, 0);
|
status = kill(pid, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* INTERRUPT */
|
case 2: /* INTERRUPT */
|
||||||
|
status = killpg(pid, SIGINT);
|
||||||
|
if(status == -1) {
|
||||||
status = kill(pid, SIGINT);
|
status = kill(pid, SIGINT);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: /* KILL */
|
case 9: /* KILL */
|
||||||
|
status = killpg(pid, SIGKILL);
|
||||||
|
if(status == -1) {
|
||||||
status = kill(pid, SIGKILL);
|
status = kill(pid, SIGKILL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15: /* TERM */
|
case 15: /* TERM */
|
||||||
|
status = killpg(pid, SIGTERM);
|
||||||
|
if(status == -1) {
|
||||||
status = kill(pid, SIGTERM);
|
status = kill(pid, SIGTERM);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
status = killpg(pid, sig); /* WHAT ?? */
|
||||||
|
if(status == -1) {
|
||||||
status = kill(pid, sig); /* WHAT ?? */
|
status = kill(pid, sig); /* WHAT ?? */
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue