diff --git a/lib/vagrant/pre-rubygems.rb b/lib/vagrant/pre-rubygems.rb index 451fdd263..5ea8a28e6 100644 --- a/lib/vagrant/pre-rubygems.rb +++ b/lib/vagrant/pre-rubygems.rb @@ -21,4 +21,12 @@ plugins = Vagrant::Plugin::Manager.instance.installed_plugins Vagrant::Bundler.instance.init!(plugins) ENV["VAGRANT_INTERNAL_BUNDLERIZED"] = "1" -Kernel.exec("vagrant", *ARGV) + +# If the VAGRANT_EXECUTABLE env is set, then we use that to point to a +# Ruby file to directly execute. Otherwise, we just depend on PATH lookup. +# This minor optimization can save hundreds of milliseconds on Windows. +if ENV["VAGRANT_EXECUTABLE"] + Kernel.exec("ruby", ENV["VAGRANT_EXECUTABLE"], *ARGV) +else + Kernel.exec("vagrant", *ARGV) +end