Always use a process group in helper for involing test applications
So far only the implementation using Boost.Process was using a process group; with this change also the implementation using POSIX APIs uses a process group. This way the code can wait until all sub processes have terminated.
This commit is contained in:
parent
995c315377
commit
b526d79eaf
|
@ -542,6 +542,7 @@ static int execAppInternal(const char *appPath, const char *const *args, std::st
|
|||
// get return code
|
||||
int childReturnCode;
|
||||
waitpid(child, &childReturnCode, 0);
|
||||
waitpid(-child, nullptr, 0);
|
||||
return childReturnCode;
|
||||
} else {
|
||||
// child process
|
||||
|
@ -553,6 +554,12 @@ static int execAppInternal(const char *appPath, const char *const *args, std::st
|
|||
close(readCerrPipe);
|
||||
close(writeCerrPipe);
|
||||
|
||||
// -> create process group
|
||||
if (setpgid(0, 0)) {
|
||||
cerr << Phrases::Error << "Unable create process group: " << std::strerror(errno) << Phrases::EndFlush;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// -> modify environment variable LLVM_PROFILE_FILE to apply new path for profiling output
|
||||
if (!newProfilingPath.empty()) {
|
||||
setenv("LLVM_PROFILE_FILE", newProfilingPath.data(), true);
|
||||
|
|
Loading…
Reference in New Issue