From 38f3e3e7ba210bbc45c2077102c308ed8abae061 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 8 Jun 2025 16:32:01 -0400 Subject: *.sh: Don't shadow the global nproc This avoids the need for the bash 3 workaround of running command nproc in a subshell. --- tests/getopts.sh | 2 +- tests/util.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/getopts.sh b/tests/getopts.sh index cbb3ce4..a16511f 100644 --- a/tests/getopts.sh +++ b/tests/getopts.sh @@ -5,7 +5,7 @@ ## Argument parsing -JOBS=$(nproc) +JOBS=$(_nproc) MAKE= PATTERNS=() SUDO=() diff --git a/tests/util.sh b/tests/util.sh index e3eca60..1718a1a 100644 --- a/tests/util.sh +++ b/tests/util.sh @@ -194,9 +194,9 @@ pop_defers() { ## Parallelism # Get the number of processors -nproc() { +_nproc() { { - (command nproc) \ + nproc \ || sysctl -n hw.ncpu \ || getconf _NPROCESSORS_ONLN \ || echo 1 -- cgit v1.2.3