summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/exec.rb4
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--spec/commands/exec_spec.rb9
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index f0ce450959..e0ae7f4101 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -23,7 +23,9 @@ module Bundler
validate_cmd!
SharedHelpers.set_bundle_environment
if bin_path = Bundler.which(cmd)
- return kernel_load(bin_path, *args) if ruby_shebang?(bin_path)
+ if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
+ return kernel_load(bin_path, *args)
+ end
# First, try to exec directly to something in PATH
if Bundler.current_ruby.jruby_18?
kernel_exec(bin_path, *args)
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index e5c2581067..1bcef662c0 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -6,6 +6,7 @@ module Bundler
BOOL_KEYS = %w(
allow_offline_install
cache_all
+ disable_exec_load
disable_local_branch_check
disable_shared_gems
frozen
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 4e2bdbbb7a..8c76797147 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -546,6 +546,15 @@ describe "bundle exec" do
it_behaves_like "it runs"
end
+ context "when disable_exec_load is set" do
+ let(:exec) { "EXEC: exec" }
+ before do
+ bundle "config disable_exec_load true"
+ end
+
+ it_behaves_like "it runs"
+ end
+
context "signals being trapped by bundler" do
let(:executable) { strip_whitespace <<-RUBY }
#{shebang}