Bug 11431 – std.file.slurp fails with Windows newlines

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-03T08:35:57Z
Last change time
2020-03-21T03:56:38Z
Keywords
pull
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-11-03T08:35:57Z
If I create a simple "data.txt" file containing this, with Windows newlines: 10 20 30 And I try to read it with slurp: import std.file: slurp; void main() { slurp!(int)("data.txt", "%d"); } I get a stack trace: object.Exception@...\dmd2\src\phobos\std\file.d(2992): Trailing characters at the end of line: ` ' --------- 0x00413C36 in pure @safe void std.exception.bailOut(immutable(char)[], uint, const(char[])) ...
Comment #1 by b2.temp — 2018-08-25T17:13:10Z
Comment #2 by github-bugzilla — 2018-08-26T19:34:21Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/9ca114d141bf0c8cdf949b10b7396653d649de6e fix issue 11431 - std.file.slurp fails with Windows newlines https://github.com/dlang/phobos/commit/f4c6d5c25e61684594036c2f959d70dcef325365 Merge pull request #6680 from BBasile/issue-11431 fix issue 11431 - std.file.slurp fails with Windows newlines merged-on-behalf-of: Vladimir Panteleev <[email protected]>