lib/benchmark_driver/runner.rb in benchmark_driver-0.16.2 vs lib/benchmark_driver/runner.rb in benchmark_driver-0.16.3

- old
+ new

@@ -96,10 +96,20 @@ end BenchmarkDriver.const_get("Runner::#{match[:namespace]}", false) end def with_clean_env(&block) + # chruby sets GEM_HOME and GEM_PATH in your shell. We have to unset it in the child + # process to avoid installing gems to the version that is running benchmark-driver. + env = nil + ['GEM_HOME', 'GEM_PATH'].each do |var| + if ENV.key?(var) + env ||= ENV.to_h + ENV.delete(var) + end + end + unless defined?(Gem::Version) # default-gem Bundler can be loaded and broken with --disable-gems return block.call end @@ -113,8 +123,12 @@ block.call end end rescue LoadError block.call + ensure + if env + ENV.replace(env) + end end end end