From a57122243192c970d29c1539ed84a310fd176a2a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Jan 2014 17:12:01 -0800 Subject: [PATCH] core: tolerate errors in gemrc --- lib/vagrant/bundler.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index 444668672..0bec2a058 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -123,7 +123,15 @@ module Vagrant # Set a custom configuration to avoid loading ~/.gemrc loads and # /etc/gemrc and so on. - old_config = Gem.configuration + old_config = nil + begin + old_config = Gem.configuration + rescue Psych::SyntaxError + # Just ignore this. This means that the ".gemrc" file has + # an invalid syntax and can't be loaded. We don't care, because + # when we set Gem.configuration to nil later, it'll force a reload + # if it is needed. + end Gem.configuration = NilGemConfig.new # Use a silent UI so that we have no output