Skip to content

Commit 6b5f4fc

Browse files
howl-andersonseanpmorgan
authored andcommitted
Mac OS correctly fetch CPU core number (#139)
1 parent 13c4b04 commit 6b5f4fc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/ci_testing/addons_cpu.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ fi
2424

2525
set -x
2626

27-
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
27+
PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
28+
29+
if [[ ${PLATFORM} == "darwin" ]]; then
30+
N_JOBS=$(sysctl -n hw.ncpu)
31+
else
32+
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
33+
fi
34+
2835

2936
echo ""
3037
echo "Bazel will use ${N_JOBS} concurrent job(s)."

0 commit comments

Comments
 (0)