Skip to content

Commit

Permalink
bundle exec now execs using Gem.ruby -S by default
Browse files Browse the repository at this point in the history
this change ensures that commands that are run via eg `rbx -S bundle exec rake` will actually run rake via rbx, rather than running it via `which ruby`, which has an unpleasant tendency to be MRI. also adds a -s option to bundle exec just in case you need to exec something that isn't a ruby binary for some reason.
  • Loading branch information
indirect committed Apr 11, 2011
1 parent 2016e47 commit c640c9b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/bundler/cli.rb
Expand Up @@ -309,13 +309,24 @@ def package
into the systemwide Rubygems repository. into the systemwide Rubygems repository.
D D
def exec(*) def exec(*)
ARGV.delete("exec") args = ARGV.dup
args.delete("exec")

# System mode allows you to exec non-ruby binaries.
# Not that I know why you would want to do that.
system = args.shift if args.first == "-s"


Bundler.setup Bundler.setup


begin begin
# Run unless system
Kernel.exec(*ARGV) # Run the command, using the same ruby that invoked bundler
args = [Gem.ruby, "-S", *args]
end

# Run the command now that ENV is set up
Bundler.ui.debug args.join(" ")
Kernel.exec(*args)
rescue Errno::EACCES rescue Errno::EACCES
Bundler.ui.error "bundler: not executable: #{ARGV.first}" Bundler.ui.error "bundler: not executable: #{ARGV.first}"
exit 126 exit 126
Expand Down

0 comments on commit c640c9b

Please sign in to comment.