diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-02-23 15:20:04 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-02-23 15:20:04 -0600 |
commit | 45136c90c3be96107c6a350cff22072cf318bba9 (patch) | |
tree | 0e3116264103d567d16dfcb3a7437655989183a0 | |
parent | 4b2f5dd731a522d3bb0ecbac80e7faffb98e158e (diff) | |
download | bundler-45136c90c3be96107c6a350cff22072cf318bba9.tar.gz |
[Exec] Fix loading on 1.8.7seg-load-exec
-rw-r--r-- | lib/bundler/cli/exec.rb | 2 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 4f304975ce..865ac20248 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -75,7 +75,7 @@ module Bundler "#!/usr/bin/env ruby\n", "#!#{Gem.ruby}\n", ] - first_line = File.read(file, possibilities.map(&:size).max, :mode => "rb") + first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) } possibilities.any? {|shebang| first_line.start_with?(shebang) } end end diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index e6c22ead43..be2f8aa2a5 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -378,7 +378,7 @@ describe "bundle exec" do before do path.open("w") {|f| f << executable } - FileUtils.chmod("+x", path) + path.chmod(0755) install_gemfile <<-G gem "rack" @@ -422,7 +422,10 @@ describe "bundle exec" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) { "RuntimeError: ERROR\n #{path}:7:in `<top (required)>'" } + let(:expected_err) do + "RuntimeError: ERROR\n #{path}:7" + + (Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'") + end it_behaves_like "it runs" end |