Skip to content

Commit 7f1917d

Browse files
gibfahnljharb
authored andcommitted
[Refactor] Rename NVM_CPU_THREADS to NVM_CPU_CORES
1 parent 7d08ad4 commit 7f1917d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

nvm.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,28 +1777,28 @@ nvm_get_make_jobs() {
17771777
fi
17781778
local NVM_OS
17791779
NVM_OS="$(nvm_get_os)"
1780-
local NVM_CPU_THREADS
1780+
local NVM_CPU_CORES
17811781
if [ "_$NVM_OS" = "_linux" ]; then
1782-
NVM_CPU_THREADS="$(nvm_grep -c -E '^processor.+: [0-9]+' /proc/cpuinfo)"
1782+
NVM_CPU_CORES="$(nvm_grep -c -E '^processor.+: [0-9]+' /proc/cpuinfo)"
17831783
elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then
1784-
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
1784+
NVM_CPU_CORES="$(sysctl -n hw.ncpu)"
17851785
elif [ "_$NVM_OS" = "_sunos" ]; then
1786-
NVM_CPU_THREADS="$(psrinfo | wc -l)"
1786+
NVM_CPU_CORES="$(psrinfo | wc -l)"
17871787
elif [ "_$NVM_OS" = "_aix" ]; then
1788-
NVM_CPU_THREADS="$(lsconf | command grep 'Number Of Processors:'| command awk '{print $4}')"
1788+
NVM_CPU_CORES="$(lsconf | command grep 'Number Of Processors:'| command awk '{print $4}')"
17891789
fi
1790-
if ! nvm_is_natural_num "$NVM_CPU_THREADS" ; then
1791-
nvm_err 'Can not determine how many thread(s) we can use, set to only 1 now.'
1792-
nvm_err 'Please report an issue on GitHub to help us make it better and run it faster on your computer!'
1790+
if ! nvm_is_natural_num "$NVM_CPU_CORES" ; then
1791+
nvm_err 'Can not determine how many core(s) are available, running in single-threaded mode.'
1792+
nvm_err 'Please report an issue on GitHub to help us make nvm run faster on your computer!'
17931793
NVM_MAKE_JOBS=1
17941794
else
1795-
nvm_echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)"
1796-
if [ "$NVM_CPU_THREADS" -gt 2 ]; then
1797-
NVM_MAKE_JOBS=$((NVM_CPU_THREADS - 1))
1798-
nvm_echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"
1795+
nvm_echo "Detected that you have $NVM_CPU_CORES CPU core(s)"
1796+
if [ "$NVM_CPU_CORES" -gt 2 ]; then
1797+
NVM_MAKE_JOBS=$((NVM_CPU_CORES - 1))
1798+
nvm_echo "Running with $NVM_MAKE_JOBS threads to speed up the build"
17991799
else
18001800
NVM_MAKE_JOBS=1
1801-
nvm_echo 'Number of CPU thread(s) less or equal to 2 will have only one job a time for `make`'
1801+
nvm_echo 'Number of CPU core(s) less than or equal to 2, running in single-threaded mode'
18021802
fi
18031803
fi
18041804
}
@@ -1850,7 +1850,7 @@ nvm_install_source() {
18501850
make='make'
18511851
if [ "${NVM_OS}" = 'freebsd' ]; then
18521852
make='gmake'
1853-
MAKE_CXX='CXX=c++'
1853+
MAKE_CXX='CXX=c++'
18541854
elif [ "${NVM_OS}" = 'aix' ]; then
18551855
make='gmake'
18561856
fi

0 commit comments

Comments
 (0)