Skip to content

Commit 81f595b

Browse files
committed
Fix a bug that all of ARGF contents may not be consumed
GitHub: fix GH-228 Reported by Rafael Navaza. Thanks!!!
1 parent e32b666 commit 81f595b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/csv/parser.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,10 @@ def build_scanner
768768
string = nil
769769
if @samples.empty? and @input.is_a?(StringIO)
770770
string = @input.read
771-
elsif @samples.size == 1 and @input.respond_to?(:eof?) and @input.eof?
771+
elsif @samples.size == 1 and
772+
@input != ARGF and
773+
@input.respond_to?(:eof?) and
774+
@input.eof?
772775
string = @samples[0]
773776
end
774777
if string

0 commit comments

Comments
 (0)