Skip to content

Commit

Permalink
Fix the chruby hack for non-ruby commands (#343)
Browse files Browse the repository at this point in the history
Co-authored-by: Alan Wu <[email protected]>
  • Loading branch information
k0kubun and XrXr authored Oct 24, 2024
1 parent fb25c3c commit 1b298fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions run_benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
# like `bundle install` in a child process will not use the Ruby being benchmarked.
# It overrides PATH to guarantee the commands of the benchmarked Ruby will be used.
env = {}
if `#{ruby.first} -e 'print RbConfig.ruby'` != RbConfig.ruby
env["PATH"] = "#{File.dirname(ruby.first)}:#{ENV["PATH"]}"
ruby_path = `#{ruby.shelljoin} -e 'print RbConfig.ruby'`
if ruby_path != RbConfig.ruby
env["PATH"] = "#{File.dirname(ruby_path)}:#{ENV["PATH"]}"

# 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 run_benchmarks.rb.
Expand Down

0 comments on commit 1b298fa

Please sign in to comment.