From 004df11b28054e9bf118cee6647b50754875c888 Mon Sep 17 00:00:00 2001 From: Stephen Gelman Date: Sun, 8 Jan 2017 21:54:13 -0600 Subject: [PATCH] Move check for BuildError into rescue block to avoid loading rubygems --- autoload/commandt.vim | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/autoload/commandt.vim b/autoload/commandt.vim index 64b0781b..b5d31c72 100644 --- a/autoload/commandt.vim +++ b/autoload/commandt.vim @@ -152,13 +152,6 @@ augroup END ruby << EOF # require Ruby files - EXCEPTIONS = [LoadError] - begin - require 'rubygems/ext' - EXCEPTIONS << Gem::Ext::BuildError if defined?(Gem::Ext::BuildError) - rescue LoadError - end - begin require 'command-t' @@ -174,17 +167,23 @@ ruby << EOF else $command_t = CommandT::Stub.new end - rescue *EXCEPTIONS - load_path_modified = false - ::VIM::evaluate('&runtimepath').to_s.split(',').each do |path| - lib = "#{path}/ruby" - if !$LOAD_PATH.include?(lib) && File.exist?(lib) - $LOAD_PATH << lib - load_path_modified = true + rescue Exception => e + EXCEPTIONS = [LoadError] + EXCEPTIONS << Gem::Ext::BuildError if defined?(Gem::Ext::BuildError) + if EXCEPTIONS.include? e.class + load_path_modified = false + ::VIM::evaluate('&runtimepath').to_s.split(',').each do |path| + lib = "#{path}/ruby" + if !$LOAD_PATH.include?(lib) && File.exist?(lib) + $LOAD_PATH << lib + load_path_modified = true + end end - end - retry if load_path_modified + retry if load_path_modified - $command_t = CommandT::Stub.new + $command_t = CommandT::Stub.new + else + raise e + end end EOF