Browse files

bundle exec now execs using Gem.ruby -S by default

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 c640c9b0e1574e7d40dce1e5a693e71c0ac5b5e7
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/bundler/cli.rb
@@ -309,13 +309,24 @@ def package
into the systemwide Rubygems repository.
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"
- # Run
- Kernel.exec(*ARGV)
+ unless system
+ # 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
Bundler.ui.error "bundler: not executable: #{ARGV.first}"
exit 126

0 comments on commit c640c9b

Please sign in to comment.