Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Fix hang when gemspec has incompatible encoding
Browse files Browse the repository at this point in the history
Not sure about the reason, but binary read fixes it...
  • Loading branch information
deivid-rodriguez committed Jan 31, 2018
1 parent d60aeb9 commit 30c3692
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def load_gemspec(file, validate = false)

def load_gemspec_uncached(file, validate = false)
path = Pathname.new(file)
contents = path.read
contents = path.binread
spec = if contents.start_with?("---") # YAML header
eval_yaml_gemspec(path, contents)
else
Expand Down
17 changes: 17 additions & 0 deletions spec/install/gemspecs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@
expect(the_bundle).to include_gems "activesupport 2.3.2"
end

it "does not hang when gemspec has incompatible encoding" do
create_file("foo.gemspec", <<-G)
Gem::Specification.new do |gem|
gem.name = "pry-byebug"
gem.version = "3.4.2"
gem.author = "David Rodríguez"
gem.summary = "Good stuff"
end
G

install_gemfile <<-G, :env => { "LANG" => "C" }
gemspec
G

expect(out).to include("Bundle complete!")
end

context "when ruby version is specified in gemspec and gemfile" do
it "installs when patch level is not specified and the version matches" do
build_lib("foo", :path => bundled_app) do |s|
Expand Down

0 comments on commit 30c3692

Please sign in to comment.