Hi Sven,

On 11 April 2018 at 18:53, Sven Van Caekenberghe <s...@stfx.eu> wrote:
> Something is off (and/or I am getting crazy, probably both).
>
> $ ./pharo --headless Pharo.image eval '(FileStream stdin binary; next: 3)'
> 123
> #[49]
>
> ??
>
> This should return #[49 50 51] AFAIK.

I haven't checked properly, but I can take a guess at this...

The file read primitive in FilePlugin tries to read from stdin 1
character at a time (presumably to get around the line buffering that
is done, but I haven't gone through the history.  At one time I think
it modified the terminal settings, but that code is #if'd out).  For
all other streams it attempts to read the requested number of
characters.

StandardFileStream>>readInto:startingAt:count: assumes that
primitiveFileRead will always attempt to read count bytes, but it
actually only attempts to read 1.

Cheers,
Alistair

Reply via email to