Skip to content

Instantly share code, notes, and snippets.

@dholdren
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dholdren/d3201ee2c6ce12e0add8 to your computer and use it in GitHub Desktop.
Save dholdren/d3201ee2c6ce12e0add8 to your computer and use it in GitHub Desktop.
RVM cd broken on a directory with only a Gemfile
#!/bin/bash
set -e
source "$HOME/.rvm/scripts/rvm" #so 'cd' will change gemset when dotfiles present
#setup
rm -rf ~/tmp/dir_with_gemfile
mkdir -p ~/tmp/dir_with_gemfile
echo "source 'https://rubygems.org'" > ~/tmp/dir_with_gemfile/Gemfile
echo "gem 'rails'" >> ~/tmp/dir_with_gemfile/Gemfile
#end setup
#works
echo 'pre cd ~'
cd ~
echo 'post cd ~'
#exits after "cd"
echo 'pre cd ~/tmp/dir_with_gemfile'
cd ~/tmp/dir_with_gemfile
echo 'post cd ~/tmp/dir_with_gemfile'
>./broken_cd.sh
pre cd ~
post cd ~
pre cd ~/tmp/dir_with_gemfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment