Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handle subshells and one-line commands for auto-switching #246

wants to merge 32 commits into


None yet
4 participants

Should resolve:

postmodern and others added some commits Jan 15, 2013

Use chpwd instead of preexec.
Allows 'cd foo && cmd' to see .ruby-version, as well as in subshells for

Fixes postmodern/chruby#245.

This will change the behavior of auto-switching. By checking for a .ruby-version after every command, we can immediately detect newly created .ruby-version files.


aprescott replied Jan 29, 2014

What about adding it to both sets of hooks?

What is the benefit in setting both hooks?


aprescott replied Jan 30, 2014

Well the point of using chpwd is to fix postmodern/chruby#245, as the PR says. You said that conflicts with newly created or modified .ruby-version files, which is completely understandable, but that still leaves the issue open. Adding it to both hooks maintains the behaviour and also fixes 245.

As a bonus, it also should fix postmodern/chruby#241 for zsh, like I said in my PR. Without it, some sort of set -T + zsh workaround would be needed, and 245 would still be outstanding.

@postmodern Would @aprescott's fix still be considered inefficient?

This has been open a while and needs a rebase against the 0.4.0 branch, but there are some outstanding comments above. Let me know if I should just close this, make amendments, or anything else and I can update this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment