mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-10-13 19:31:05 +02:00
Handle the case when there is no processor info in /proc/cpuinfo
`grep -c` would correctly output "0", which is handled specially later on, but would also exit with a nonzero status which would abort the script. Piping the output to `wc` to do the counting makes the exit status of grep irrelevant. Fixes #447
This commit is contained in:
parent
bc9adfdd5d
commit
35f9c62d1d
1 changed files with 1 additions and 1 deletions
|
@ -101,7 +101,7 @@ num_cpu_cores() {
|
|||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
|
||||
elif [ -r /proc/cpuinfo ]; then
|
||||
num="$(grep -c ^processor /proc/cpuinfo)"
|
||||
num="$(grep ^processor /proc/cpuinfo | wc -l)"
|
||||
[ "$num" -gt 0 ] || num=""
|
||||
fi
|
||||
echo "${num:-2}"
|
||||
|
|
Loading…
Reference in a new issue