diff --git a/common.sh b/common.sh index 014b257307..a97c560fe8 100644 --- a/common.sh +++ b/common.sh @@ -8,7 +8,10 @@ # The number of jobs to pass to tools that can run in parallel (such as make # and dpkg-buildpackage -if [[ -z ${NUM_JOBS} ]]; then +case "${NUM_JOBS}" in + *[!0-9]*) NUM_JOBS='' ;; +esac +if [[ -z ${NUM_JOBS} ]] || [[ ${NUM_JOBS} -eq 0 ]]; then NUM_JOBS=$(grep -c "^processor" /proc/cpuinfo) fi # Ensure that any sub scripts we invoke get the max proc count.