Skip to content

Commit

Permalink
Fix a bug that all of ARGF contents may not be consumed
Browse files Browse the repository at this point in the history
GitHub: fix GH-228

Reported by Rafael Navaza. Thanks!!!
  • Loading branch information
kou committed Dec 2, 2021
1 parent e32b666 commit 81f595b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/csv/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,10 @@ def build_scanner
string = nil
if @samples.empty? and @input.is_a?(StringIO)
string = @input.read
elsif @samples.size == 1 and @input.respond_to?(:eof?) and @input.eof?
elsif @samples.size == 1 and
@input != ARGF and
@input.respond_to?(:eof?) and
@input.eof?
string = @samples[0]
end
if string
Expand Down

0 comments on commit 81f595b

Please sign in to comment.