New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With chomping active, we lose a last empty line #4740
Comments
From @lizmat$ 6 spurt("bar","\n"); dd open("bar").get $ 6 'spurt("bar","\n"); dd open("bar",:!chomp).get' |
From @smlsWhen called on a string, the .lines method ignores/chomps only *one* trailing newline, and treats all other newlines as line separators: dd "\n\n\n".lines; # ("", "", "").Seq However, when called on an IO::Path or IO::Handle, it ignores/chomps up to *two* trailing newlines: spurt 'a', "\n\n\n"; Expected behavior: All three examples should print ("", "", "").Seq. |
From @lizmat
This is really RT #126598 . The problem is really that with auto-chomping (which is the default), the EOF flag is set when the last line of the file has been read. If that line is empty, however, IO::Handle.get cannot see the difference between a “real” end of file and an empty line (because the eol delimiter has already been removed). It was felt that it would be better to lose an empty line at the end, then adding one that isn’t there. This will require a fix in MoarVM. Liz |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetOn Mon, 09 Nov 2015 07:14:47 -0800, elizabeth wrote:
Thank you for the report. This is now fixed. Fix: rakudo/rakudo@f2fca0c...41bb137 |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#126598 (status was 'resolved')
Searchable as RT126598$
The text was updated successfully, but these errors were encountered: