Use subprocess.Popen instead of popen2 to stop a deprecation warning when running...
[oota-llvm.git] / 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"])