summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.cpp4
-rw-r--r--process.cpp6
2 files changed, 6 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 676b4ab..51e69d1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -230,6 +230,8 @@ int main(int argc, char **argv)
return 1;
}
+ ::setpgid(0,0); // must be called before setsid()
+ ::setsid();
Config config = parseConfigFile();
while (!args.isEmpty()) {
@@ -247,8 +249,6 @@ int main(int argc, char **argv)
}
} else if (arg == "--debug-gdb") {
useGDB = true;
- setpgid(0,0); // must be called before setsid()
- setsid();
} else if (arg == "--debug-qml") {
useQML = true;
} else if (arg == "--stop") {
diff --git a/process.cpp b/process.cpp
index abf3eab..0584ccf 100644
--- a/process.cpp
+++ b/process.cpp
@@ -222,12 +222,14 @@ void Process::stop()
if (kill(mDebuggee, SIGKILL) != 0)
perror("Could not kill debugee");
}
- if (kill(-getpid(), SIGTERM) != 0)
- perror("Could not kill process group");
mProcess->terminate();
if (!mProcess->waitForFinished())
mProcess->kill();
+
+ // Just for completeness terminate the whole group
+ // in case the application has started subprocesses
+ ::kill(-getpid(), SIGTERM);
}
void Process::incomingConnection(int i)