On 11 April 2018 at 19:42, Nicolas Cellier
<nicolas.cellier.aka.n...@gmail.com> wrote:
>
>
> 2018-04-11 19:08 GMT+02:00 Alistair Grant <akgrant0...@gmail.com>:
>>
>> 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
>>
>
> https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/150

Thanks!  I'd already looked at this routine and found it strangely
constructed.  Having some background discussion will help a lot.

Cheers,
Alistair

Reply via email to