diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2025-04-17 19:30:58 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2025-04-17 19:30:58 -0400 |
commit | 16649a99898b2739f4eb313ec156f3218809da20 (patch) | |
tree | 7e6bca7edc36d78d8db16eb154ab77603bc8d9d6 | |
parent | 7102fec257835302cb4978160bba4cbebd0b63e1 (diff) | |
download | bfs-16649a99898b2739f4eb313ec156f3218809da20.tar.xz |
configure: Work around a Bash 3 bug
Before Bash 4, the `command` builtin did not work properly in AND-OR
lists when set -e was active, leading to
set -e
command nonesuch || echo none
failing without echoing. Work around it by runing `command nproc` in a
subshell.
Link: https://stackoverflow.com/q/68143965
-rwxr-xr-x | configure | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -87,7 +87,9 @@ invalid() { # Get the number of cores to use nproc() { { - command nproc \ + # Run command nproc in a subshell to work around a bash 3 bug + # https://stackoverflow.com/q/68143965 + (command nproc) \ || sysctl -n hw.ncpu \ || getconf _NPROCESSORS_ONLN \ || echo 1 |