Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit c640c9b0e1574e7d40dce1e5a693e71c0ac5b5e7 1 parent 2016e47
@indirect indirect authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/bundler/cli.rb
View
17 lib/bundler/cli.rb
@@ -309,13 +309,24 @@ def package
into the systemwide Rubygems repository.
D
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
begin
- # 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
Please sign in to comment.
Something went wrong with that request. Please try again.