Add SunOS case statement to num_cpu_cores

This commit is contained in:
Kjetil Limkjær 2017-12-14 22:17:34 +01:00
parent c5e4bab858
commit 5149c53165

View file

@ -155,8 +155,11 @@ num_cpu_cores() {
Darwin | *BSD ) Darwin | *BSD )
num="$(sysctl -n hw.ncpu 2>/dev/null || true)" num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
;; ;;
SunOS )
num="$(getconf NPROCESSORS_ONLN 2>/dev/null)"
;;
* ) * )
num="$({ getconf _NPROCESSORS_ONLN || getconf NPROCESSORS_ONLN || num="$({ getconf _NPROCESSORS_ONLN ||
grep -c ^processor /proc/cpuinfo; } 2>/dev/null)" grep -c ^processor /proc/cpuinfo; } 2>/dev/null)"
num="${num#0}" num="${num#0}"
;; ;;