[Win32utils-devel] IO.read questions
Luis Lavena
luislavena at gmail.com
Thu May 3 01:02:54 UTC 2012
On Wed, May 2, 2012 at 9:48 PM, Daniel Berger <djberg96 at gmail.com> wrote:
> Hi,
>
> ruby 1.9.3p125 (both mingw and mswin)
>
> Is this a bug? I've got a file, test.txt, that contains nothing but this:
>
> This is line 1
> This is line 2
> This is line 3
>
> I ran these snippets of code:
>
> IO.read('test.txt') # => "This is line 1\nThis is line
> 2\nThis is line 3\n"
> IO.read('test.txt', nil) # => "This is line 1\nThis is line
> 2\nThis is line 3\n"
> IO.read('test.txt', nil, 0) # => "This is line 1\r\nThis is line
> 2\r\nThis is line 3\r\n"
>
> Why are the native line endings retained if I specify an offset? Ruby
> 1.8.x doesn't do that, btw.
>
A regression fixed in patch level 194
Root issue is caused by newline universal:
https://bugs.ruby-lang.org/issues/6271
Along other like File#pos
Cheers,
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
More information about the win32utils-devel
mailing list