lib/benchmark_driver/runner.rb in benchmark_driver-0.10.4 vs lib/benchmark_driver/runner.rb in benchmark_driver-0.10.5
- old
+ new
@@ -30,11 +30,13 @@
runner = runner_for(klass)
output = Output.find(config.output_type).new(
jobs: jobs,
executables: config.executables,
)
- runner.new(config: runner_config, output: output).run(jobs)
+ with_clean_env do
+ runner.new(config: runner_config, output: output).run(jobs)
+ end
end
end
private
@@ -44,8 +46,17 @@
def runner_for(klass)
unless match = klass.name.match(/\ABenchmarkDriver::Runner::(?<namespace>[^:]+)::Job\z/)
raise "Unexpected job class: #{klass}"
end
BenchmarkDriver.const_get("Runner::#{match[:namespace]}", false)
+ end
+
+ def with_clean_env(&block)
+ require 'bundler'
+ Bundler.with_clean_env do
+ block.call
+ end
+ rescue LoadError
+ block.call
end
end
end