Skip to content

Commit 8a29186

Browse files
authored
Merge pull request #65 from Frederick888/compat-no-nproc
read from /proc/cpuinfo when `nproc` doesn't exist
2 parents 8dbb2cd + 422e99d commit 8a29186

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/helpers.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ temp_status() {
7070

7171
cpus_number() {
7272
if is_linux; then
73-
nproc
73+
if command_exists "nproc"; then
74+
nproc
75+
else
76+
echo "$(( $(sed -n 's/^processor.*:\s*\([0-9]\+\)/\1/p' /proc/cpuinfo | tail -n 1) + 1 ))"
77+
fi
7478
else
7579
sysctl -n hw.ncpu
7680
fi

0 commit comments

Comments
 (0)