Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix IO::Handle not correctly limiting lines in batch processing
The iterator's push-all did not actually stop iteration when $!todo got down
to 0. Also it did not close the file handle on reaching eof despite being asked
to do so.

Fixes regression in S16-filehandles/io.t
  • Loading branch information
niner committed Sep 19, 2015
1 parent 7ee6ef9 commit a3962b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/IO/Handle.pm
Expand Up @@ -410,10 +410,11 @@ my class IO::Handle does IO {
!! nqp::p6box_s($line)
);
$ins = $ins + 1;
$line = nqp::readlinefh($!PIO) if --$!todo;
$line = --$!todo ?? nqp::readlinefh($!PIO) !! '';
}
nqp::bindattr_i($!handle, IO::Handle, '$!ins', $ins);
IterationEnd;
$!handle.close if $!close and nqp::eoffh($!PIO);
IterationEnd
}
}.new(self, $close, $first, $todo));
}
Expand Down

0 comments on commit a3962b0

Please sign in to comment.