fix: make ypi launcher work on macOS bash 3.2#3
Open
BleedingDev wants to merge 1 commit into
Open
Conversation
csaroff
reviewed
Feb 18, 2026
csaroff
left a comment
There was a problem hiding this comment.
Real human here:
I can confirm that your fixes worked for me, but I think you could make it slightly more concise :)
Comment on lines
+119
to
+128
| # Bash 3.2 (macOS) + `set -u` treats `${empty_array[@]}` as unbound. | ||
| # Build argv incrementally so zero-length arrays stay zero-arg. | ||
| PI_ARGS=(pi --system-prompt "$COMBINED_PROMPT") | ||
| if [ ${#YPI_EXT_ARGS[@]} -gt 0 ]; then | ||
| PI_ARGS+=("${YPI_EXT_ARGS[@]}") | ||
| fi | ||
| if [ ${#PASS_ARGS[@]} -gt 0 ]; then | ||
| PI_ARGS+=("${PASS_ARGS[@]}") | ||
| fi | ||
| exec "${PI_ARGS[@]}" |
There was a problem hiding this comment.
Suggested change
| # Bash 3.2 (macOS) + `set -u` treats `${empty_array[@]}` as unbound. | |
| # Build argv incrementally so zero-length arrays stay zero-arg. | |
| PI_ARGS=(pi --system-prompt "$COMBINED_PROMPT") | |
| if [ ${#YPI_EXT_ARGS[@]} -gt 0 ]; then | |
| PI_ARGS+=("${YPI_EXT_ARGS[@]}") | |
| fi | |
| if [ ${#PASS_ARGS[@]} -gt 0 ]; then | |
| PI_ARGS+=("${PASS_ARGS[@]}") | |
| fi | |
| exec "${PI_ARGS[@]}" | |
| exec pi --system-prompt "$COMBINED_PROMPT" "${YPI_EXT_ARGS[@]:-}" "${PASS_ARGS[@]:-}" |
Author
There was a problem hiding this comment.
I'll leave that to real maintainer of the codebase. :) My goal was to just show possible fix. :)
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.
Summary
Fixes macOS startup failures in the
ypilauncher by addressing two shell-compatibility issues:set -u+ empty array expansion on Bash 3.2 (PASS_ARGS[@]: unbound variable)mktemptemplate usage on BSD/macOSChanges
mktemp "${TMPDIR:-/tmp}/ypi_system_prompt.XXXXXX"piargv incrementally and only append optional arrays when non-empty:"${empty_array[@]}"nounset crash on macOS system Bash 3.2tests/test_unit.sh:ypiwith no pass-through args and asserts it reaches mockpiRepro verified
On macOS with
/bin/bash3.2:ypino longer crashes withPASS_ARGS[@]: unbound variableypiinvocations no longer fail withmktemp ... File existsRelated issues
mktempportability issue)