Skip to content

fix(toolkit): run the scripts with the bash 3.2 that macOS ships - #12

Merged
WhiteMuush merged 1 commit into
mainfrom
fix/macos-bash-3.2
Oct 2, 2026
Merged

WhiteMuush merged 1 commit into
mainfrom
fix/macos-bash-3.2

Conversation

@WhiteMuush

Copy link
Copy Markdown
Member

On macOS, make menu stopped at the setup step: mapfile: command not found, then candidates[@]: unbound variable. macOS ships bash 3.2 and the scripts used bash 4 features.

Changes:

  • read_lines in core.sh replaces mapfile -t (setup, benchmark, lint)
  • ui_pick copies the caller arrays with eval instead of a nameref (local -n)
  • arrays that can be empty expand as ${a[@]+"${a[@]}"}, an empty array fails under set -u before bash 4.4
  • ui_ask_secret uses a 1s escape timeout on bash 3.2, which rejects read -t 0.05

Tested in Docker with bash 3.2.57, 4.0 and 5.3 (ui_pick, setup_pick_value with no candidates, read_lines, ui_ask_secret), bash -n on every script under 3.2, and shellcheck -x. Not run on a real Mac.

macOS stops at mapfile and then on an empty array under set -u.
- read_lines in core.sh replaces mapfile -t
- ui_pick copies the caller arrays with eval instead of a nameref (local -n)
- arrays that can be empty expand as ${a[@]+"${a[@]}"}
- ui_ask_secret falls back to a 1s escape timeout, bash 3.2 rejects 0.05
@WhiteMuush
WhiteMuush merged commit 6245266 into main Oct 2, 2026
1 check failed
@WhiteMuush
WhiteMuush deleted the fix/macos-bash-3.2 branch October 2, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant