Skip to content

Commit

Permalink
* lib/rubygems/stub_specification.rb (Gem::StubSpecification#data):
Browse files Browse the repository at this point in the history
  should not change the value of $. when `require`ing gems.
  this fixed test failures introduced by r51813.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Sep 9, 2015
1 parent 40f304e commit 5e262e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
Wed Sep 9 18:16:14 2015 NAKAMURA Usaku <usa@ruby-lang.org>

* lib/rubygems/stub_specification.rb (Gem::StubSpecification#data):
should not change the value of $. when `require`ing gems.
this fixed test failures introduced by r51813.

Wed Sep 9 16:55:45 2015 NAKAMURA Usaku <usa@ruby-lang.org>

* ruby.c (usage, enable_option, disable_option, process_options): new
Expand Down
25 changes: 15 additions & 10 deletions lib/rubygems/stub_specification.rb
Expand Up @@ -73,18 +73,23 @@ def data
unless @data
@extensions = []

open loaded_from, OPEN_MODE do |file|
begin
file.readline # discard encoding line
stubline = file.readline.chomp
if stubline.start_with?(PREFIX) then
@data = StubLine.new stubline

@extensions = $'.split "\0" if
/\A#{PREFIX}/ =~ file.readline.chomp
begin
saved_lineno = $.
open loaded_from, OPEN_MODE do |file|
begin
file.readline # discard encoding line
stubline = file.readline.chomp
if stubline.start_with?(PREFIX) then
@data = StubLine.new stubline

@extensions = $'.split "\0" if
/\A#{PREFIX}/ =~ file.readline.chomp
end
rescue EOFError
end
rescue EOFError
end
ensure
$. = saved_lineno
end
end

Expand Down

0 comments on commit 5e262e5

Please sign in to comment.