diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-10 14:08:32 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-10 14:08:32 -0500 |
commit | 3506b72eed0d5647823cfa6b9b6653048332aa97 (patch) | |
tree | 5d0c748418fd4663e450cb4dc5a5158c40e613a3 | |
parent | 114d42b4591f18bffac0af1b87f5bc37a41d81e6 (diff) | |
download | bundler-3506b72eed0d5647823cfa6b9b6653048332aa97.tar.gz |
Add a setting for disable_exec_loadseg-disable-exec-load
-rw-r--r-- | lib/bundler/cli/exec.rb | 4 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 9 |
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} |