We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Base.isdone(itr::EachLine, state...)
1 parent fd43841 commit ede6486Copy full SHA for ede6486
2 files changed
base/io.jl
@@ -1023,6 +1023,8 @@ eltype(::Type{<:EachLine}) = String
1023
1024
IteratorSize(::Type{<:EachLine}) = SizeUnknown()
1025
1026
+isdone(itr::EachLine, state...) = eof(itr.stream)
1027
+
1028
struct ReadEachIterator{T, IOT <: IO}
1029
stream::IOT
1030
end
test/read.jl
@@ -617,3 +617,12 @@ let p = Pipe()
617
wait(t)
618
close(p)
619
620
621
+@testset "issue #27412" begin
622
+ itr = eachline(IOBuffer("a"))
623
+ @test !isempty(itr)
624
+ # check that the earlier isempty did not consume the iterator
625
626
+ first(itr) # consume the iterator
627
+ @test isempty(itr) # now it is empty
628
+end
0 commit comments