summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/multiprocessing/__init__.py')
-rw-r--r--Lib/multiprocessing/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/multiprocessing/__init__.py b/Lib/multiprocessing/__init__.py
index adad630..deb031c 100644
--- a/Lib/multiprocessing/__init__.py
+++ b/Lib/multiprocessing/__init__.py
@@ -115,8 +115,11 @@ def cpu_count():
except (ValueError, KeyError):
num = 0
elif 'bsd' in sys.platform or sys.platform == 'darwin':
+ comm = '/sbin/sysctl -n hw.ncpu'
+ if sys.platform == 'darwin':
+ comm = '/usr' + comm
try:
- with os.popen('sysctl -n hw.ncpu') as p:
+ with os.popen(comm) as p:
num = int(p.read())
except ValueError:
num = 0