mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-11-25 21:30:55 +01:00
num_cpu_cores: Prefer getconf over cpuinfo grep, simplify grep usage
This commit is contained in:
parent
eabe1f36a5
commit
67c47603ee
1 changed files with 2 additions and 1 deletions
|
|
@ -154,7 +154,8 @@ num_cpu_cores() {
|
||||||
num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
|
num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
num="$(grep ^processor /proc/cpuinfo 2>/dev/null | wc -l | xargs)"
|
num="$({ getconf _NPROCESSORS_ONLN ||
|
||||||
|
grep -c ^processor /proc/cpuinfo; } 2>/dev/null)"
|
||||||
num="${num#0}"
|
num="${num#0}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue