vagrant
https://github.com/mitchellh/vagrant
Ruby
Vagrant is a tool for building and distributing development environments.
Vagrant::Util::Subprocess#jailbreak
This is, quite possibly, the saddest function in all of Vagrant. If a user is running Vagrant via Bundler (but not via the official installer), we want to reset to the "original" environment so that when shelling out to other Ruby processes (specifically), the original environment is restored. This is super important for things like rbenv and chruby, who rely on environment variables to locate gems, but Bundler stomps on those environment variables like an angry T-Rex after watching Jurassic Park 2 and realizing they replaced you with CGI. If a user is running in Vagrant via the official installer, BUT trying to execute a subprocess *outside* of the installer, we want to reset to the "original" environment. In this case, the Vagrant installer actually knows what the original environment was and replaces it completely. Finally, we reset any Bundler-specific environment variables, since the subprocess being called could, itself, be Bundler. And Bundler does not behave very nicely in these circumstances. This function was added in Vagrant 1.7.3, but there is a failsafe because the author doesn't trust himself that this functionality won't break existing assumptions, so users can specify `VAGRANT_SKIP_SUBPROCESS_JAILBREAK` and none of the above will happen. This function modifies the given hash in place!
Edit
git clone [email protected]:mitchellh/vagrant.git
cd vagrant
open lib/vagrant/util/subprocess.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Vagrant--Util--Subprocess-jailbreak-for-pr
# Commit to gitgit add lib/vagrant/util/subprocess.rbgit commit -m "better docs for Vagrant::Util::Subprocess#jailbreak"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Vagrant--Util--Subprocess-jailbreak-for-pr
hub pull-request
# Celebrate!