Fix _lp_CPUNUM on Linux when 'nproc' is missing

On Linux, hide the "command not found" message on Linux when 'nproc'
is missing and the grep fallback is used.
(nproc doesn't exist on Debian Lenny, see issue #31 and #36)
This commit is contained in:
Olivier Mengué 2012-08-16 00:22:49 +02:00
parent fc7b317c1f
commit 9feb14caa5

View File

@ -146,7 +146,7 @@ fi
# Get cpu count
case "$LP_OS" in
Linux) _lp_CPUNUM=$( nproc || grep -c '^[Pp]rocessor' /proc/cpuinfo ) ;;
Linux) _lp_CPUNUM=$( nproc 2>/dev/null || grep -c '^[Pp]rocessor' /proc/cpuinfo ) ;;
FreeBSD) _lp_CPUNUM=$( sysctl -n hw.ncpu ) ;;
SunOS) _lp_CPUNUM=$( kstat -m cpu_info | grep -c "module: cpu_info" ) ;;
esac