[Lldb-commits] [lldb] 8d8f8b3 - [lldb/Test] Don't leak forked processes on Darwin

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri May 29 13:58:19 PDT 2020


Author: Jonas Devlieghere
Date: 2020-05-29T13:58:12-07:00
New Revision: 8d8f8b353175b50dfdb1e2d5f3c0ada0a4ad25ed

URL: https://github.com/llvm/llvm-project/commit/8d8f8b353175b50dfdb1e2d5f3c0ada0a4ad25ed
DIFF: https://github.com/llvm/llvm-project/commit/8d8f8b353175b50dfdb1e2d5f3c0ada0a4ad25ed.diff

LOG: [lldb/Test] Don't leak forked processes on Darwin

We are leaking forked processes on macOS because the cleanup function
was checking the existence of /proc/pid which does not exist on macOS.
I've changed the code to be platform agnostic.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 0dee4f217c80..04ba7ea02d09 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -884,8 +884,10 @@ def cleanupSubprocesses(self):
         del self.subprocesses[:]
         # Ensure any forked processes are cleaned up
         for pid in self.forkedProcessPids:
-            if os.path.exists("/proc/" + str(pid)):
+            try:
                 os.kill(pid, signal.SIGTERM)
+            except OSError:
+                pass
 
     def spawnSubprocess(self, executable, args=[], install_remote=True):
         """ Creates a subprocess.Popen object with the specified executable and arguments,


        


More information about the lldb-commits mailing list