Merge pull request #7889 from chrisroberts/fix/einval-bundler

core: Rescue EINVAL exceptions when loading bundler
This commit is contained in:
Chris Roberts 2016-10-11 12:58:15 -07:00 committed by GitHub
commit 1f988b53ce
1 changed files with 16 additions and 1 deletions

View File

@ -66,7 +66,22 @@ end
# Setup our dependencies by initializing Bundler. If we're using plugins, # Setup our dependencies by initializing Bundler. If we're using plugins,
# then also initialize the paths to the plugins. # then also initialize the paths to the plugins.
require "bundler" begin
require "bundler"
rescue Errno::EINVAL
# Bundler can generated the EINVAL error during initial require, which means
# nothing has yet been setup (so no access to I18n). Note that vagrant has
# failed early and copy information related to problem and possible solution.
$stderr.puts "Vagrant failed to initialize at a very early stage:\n\n"
$stderr.puts "Vagrant received an "EINVAL" error while attempting to set some"
$stderr.puts "environment variables. This is usually caused by the total size of your"
$stderr.puts "environment variables being too large. Vagrant sets a handful of"
$stderr.puts "environment variables to function and requires this to work. Please"
$stderr.puts "delete some environment variables prior to executing Vagrant to"
$stderr.puts "fix this."
exit 255
end
begin begin
$vagrant_bundler_runtime = Bundler.setup(:default, :plugins) $vagrant_bundler_runtime = Bundler.setup(:default, :plugins)
rescue Bundler::GemNotFound rescue Bundler::GemNotFound