Make RUBIES a colon-delimited string instead of an array - #508
Draft
kbrock wants to merge 1 commit into
Draft
Conversation
Motivation --- Fix chruby in Claude. Core issue is RUBIES is not set in claude shells. Before --- RUBIES was a bash array, and bash arrays cannot be exported. So every fresh subshell — including every Claude Code Bash tool call — started with an empty RUBIES and chruby failed to resolve any Ruby version, even though RUBY_ROOT, GEM_HOME, and PATH were already set correctly in that same subshell. After --- RUBIES is exported as a colon-delimited string, like PATH, so chruby resolves correctly in any subshell, including Claude's. One side effect: RUBIES now shows up in every child process's environment (e.g. in `env` output), which it never did as an array.
Contributor
Author
|
punting. think the solution is to go with chruby-list from 1.0. the catch is chruby-list still uses an array, which breaks in much the same way. |
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.
Motivation
Fix
chrubyin Claude usingbash.RUBIESis not ending up in subshells, sochrubyenvironments are wonky in Claude.You have to essentially
source /usr/local/share/chruby.sh ; chruby 4.0 ; rubyTMI
Claude copies all functions and sets them into a subshell (not via sourcing
.bashrc)So functions that get defined in
chruby.shwill end up in subshells.It inherits environmental variables via the typical
exportmechanism.So if you do not
export ENV, then that will not be in shells - this is an issue.Array ENV variables can not be
export-ed - this is an issue.Our issue:
RUBIESis not exported and it can't be exported because it is an array.Solution is to not define
RUBIES(v1.0) or to defineRUBIESas a string (this PR)Before
RUBIES was a bash array, and bash arrays cannot be exported. So every fresh subshell — including every Claude Code Bash tool call — started with an empty RUBIES and chruby failed to resolve any Ruby version, even though RUBY_ROOT, GEM_HOME, and PATH were already set correctly in that same subshell.
After
RUBIES is exported as a colon-delimited string, like PATH, so chruby resolves correctly in any subshell, including Claude's. One side effect: RUBIES now shows up in every child process's environment (e.g. in
envoutput), which it never did as an array.