Repository navigation
fix(toolkit): run the scripts with the bash 3.2 that macOS ships - #12
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS,
make menustopped at the setup step:mapfile: command not found, thencandidates[@]: unbound variable. macOS ships bash 3.2 and the scripts used bash 4 features.Changes:
read_linesincore.shreplacesmapfile -t(setup, benchmark, lint)ui_pickcopies the caller arrays withevalinstead of a nameref (local -n)${a[@]+"${a[@]}"}, an empty array fails underset -ubefore bash 4.4ui_ask_secretuses a 1s escape timeout on bash 3.2, which rejectsread -t 0.05Tested 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 -non every script under 3.2, andshellcheck -x. Not run on a real Mac.