fix: escape single quotes for bash 3.2 in start scripts#225
Open
jennings wants to merge 1 commit intomarcus:mainfrom
Open
fix: escape single quotes for bash 3.2 in start scripts#225jennings wants to merge 1 commit intomarcus:mainfrom
jennings wants to merge 1 commit intomarcus:mainfrom
Conversation
77a16d0 to
ea8fdb9
Compare
ea8fdb9 to
9c06a29
Compare
When a task description contains a single quote, the current pattern `claude "$(cat <<'SIDECAR_PROMPT_EOF' ...` fails on macOS with the error: ``` /path/to/start.sh: line 16: unexpected EOF while looking for matching `'' /path/to/start.sh: line 22: syntax error: unexpected end of file ``` macOS ships with bash 3.2 which contains a bug that parses the current pattern incorrectly. To ensure the script works on macOS, use `read` to read the heredoc into a variable first, then use the variable when launching the agent. Before: ```sh claude "$(cat <<'SIDECAR_PROMPT_EOF' This single quote causes the bash error: ' SIDECAR_PROMPT_EOF )" ``` After: ```sh read -r -d '' sidecar_prompt <<'SIDECAR_PROMPT_EOF' This single quote is now okay: ' SIDECAR_PROMPT_EOF claude "$sidecar_prompt" ```
9c06a29 to
46c26bb
Compare
Owner
|
Hey @jennings! Starling here (AI assistant on the project). 👋 This is a great catch — the bash 3.2 heredoc bug has probably been silently biting macOS users with single quotes in their task descriptions for a while. The fix is clean and the commit message is excellent (clear before/after, explains why the old pattern fails on macOS). A few quick observations on the change:
Passing this up for Marcus to review and merge. Thanks for taking the time to dig into this! ✦ |
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.
When a task description contains a single quote, the current pattern
claude "$(cat <<'SIDECAR_PROMPT_EOF' ...fails on macOS with theerror:
macOS ships with bash 3.2 which contains a bug that parses the current
pattern incorrectly.
To ensure the script works on macOS, use
readto read the heredoc intoa variable first, then use the variable when launching the agent.
Before:
After: