Index: lldb/packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -428,6 +428,7 @@ stdout=PIPE, stderr=PIPE, shell=True, + preexec_fn=os.setsid, **kwargs) pid = process.pid this_output, this_error = process.communicate() @@ -889,13 +890,16 @@ def cleanupSubprocesses(self): # Ensure any subprocesses are cleaned up for p in self.subprocesses: - p.terminate() + try: + os.kill(os.getpgid(p.pid), signal.SIGTERM) + except OSError: + pass del p del self.subprocesses[:] # Ensure any forked processes are cleaned up for pid in self.forkedProcessPids: try: - os.kill(pid, signal.SIGTERM) + os.kill(os.getpgid(pid), signal.SIGTERM) except OSError: pass del self.forkedProcessPids[:] @@ -919,8 +923,9 @@ fd = os.open(os.devnull, os.O_RDWR) os.dup2(fd, 1) os.dup2(fd, 2) - # This call causes the child to have its of group ID - os.setpgid(0, 0) + # Creates a new session if the calling process is not a process + # group leader. + os.setsid() os.execvp(executable, [executable] + args) # Give the child time to get through the execvp() call time.sleep(0.1)