Last active
December 15, 2015 14:28
-
-
Save rys/5274314 to your computer and use it in GitHub Desktop.
Updated CPU count detection for BSD-based OSes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/scripts/functions/build_config b/scripts/functions/build_config | |
index a58ac98..44fb6a5 100755 | |
--- a/scripts/functions/build_config | |
+++ b/scripts/functions/build_config | |
@@ -370,7 +370,21 @@ __rvm_detect_max_threads() | |
{ | |
case "$(uname)" in | |
(Darwin|FreeBSD) | |
- sysctl -n hw.ncpu | |
+ if | |
+ __rvm_which sysctl >/dev/null | |
+ then | |
+ sysctl -n hw.ncpu | |
+ elif | |
+ [[ -x /usr/sbin/sysctl ]] | |
+ then | |
+ /usr/sbin/sysctl -n hw.ncpu | |
+ elif | |
+ [[ -x /sbin/sysctl ]] | |
+ then | |
+ /sbin/sysctl -n hw.ncpu | |
+ else | |
+ echo 1 | |
+ fi | |
;; | |
(*) | |
cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'one';) | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment