Use subprocess.Popen instead of popen2 to stop a deprecation warning when running lit on OS X

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134324 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jordy Rose 2011-07-02 17:28:55 +00:00
parent d6b98e8bd8
commit 2f494b6afc

View File

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