Use subprocess.Popen instead of popen2 to stop a deprecation warning when running...
authorJordy Rose <jediknil@belkadan.com>
Sat, 2 Jul 2011 17:28:55 +0000 (17:28 +0000)
committerJordy Rose <jediknil@belkadan.com>
Sat, 2 Jul 2011 17:28:55 +0000 (17:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134324 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/Util.py

index 5635f50baef337f25f67bc44cbae505b1d40c608..226e453f2859f4a419ed3465eb33b208e37aaffa 100644 (file)
@@ -12,7 +12,7 @@ def detectCPUs():
             if isinstance(ncpus, int) and ncpus > 0:
                 return ncpus
         else: # OSX:
-            return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+            return int(capture(['sysctl', '-n', 'hw.ncpu']))
     # Windows:
     if os.environ.has_key("NUMBER_OF_PROCESSORS"):
         ncpus = int(os.environ["NUMBER_OF_PROCESSORS"])