[squeak-dev] Windows, stdin, stdout
Eliot Miranda
eliot.miranda at gmail.com
Sun Apr 8 15:25:34 UTC 2018
Hi Alistair,
> On Apr 8, 2018, at 5:23 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
>
> Hi Eliot,
>
>> On 8 April 2018 at 03:02, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> Hi Alistair,
>>
>> On Sat, Apr 7, 2018 at 12:32 PM, Alistair Grant <akgrant0710 at gmail.com>
>> wrote:
>>>
>>>> On 7 April 2018 at 20:29, K K Subbu <kksubbu.ml at gmail.com> wrote:
>>>>> On Saturday 07 April 2018 08:14 PM, Eliot Miranda wrote:
>>>>>
>>>>> $ cd image
>>>>> $ ./buildspurtrunkreaderimage.sh
>>>>> $ myvm spurreader.image
>>>>> squeak> 3 + 4!
>>>>> 7
>>>>> squeak> Smalltalk quit!
>>>>
>>>>
>>>> Nice. This can become a good smoke test at the end of the build*.sh:
>>>>
>>>> /bin/echo -e '14*3!\nSmalltalk quit!' | $VM spurreader.image
>>>>
>>>> Now there's the answer to life, the universe and everything ;-)
>>>>
>>>> Regards .. Subbu
>>>
>>>
>>> Interesting idea... But even the old VM doesn't provide the answer.
>>
>>
>> It will do, but that \n must be a ^M. So if one types '3+4! followed by
>> ctrl-v carriage return, followed by Smalltalk quit!' then echo will echo a
>> carriage return. But since the REPL is actually reading chunk format (hence
>> the !'s) one doesn't need the carriage return at all and one should be able
>> to say
>>
>> echo '3+4!Smalltalk quit!' | $VM spurreader.image
>>
>> and see "squeak> 7
>> squeak> " printed to stdout
>>
>>> Piped input is working in general with my new test VM. I'll have to
>>> figure out why the reader image doesn't handle it.
>
> In this case:
>
> - PositionableStream>>nextChunkNoTag calls #peek
> - #peek tries to save the state, which tries to read the stream position.
> - And getting the stream position doesn't seem to be supported for piped input.
> - So an Error is raised.
> - But because the input processing is done outside the exception
> handler, there's nothing to catch the error.
> - And the system becomes unresponsive (when run headless).
>
> I want to get #primitiveFileAtEnd working first - I've written the
> code, I just need to run it through the usual test suites.
Agreed. And having peek work on stdin, as if used to, is essential. Consider the reader part of the tests.
>
> Adding a primitivePeek would be trivial and should also work with
> piped input. I might have a look at this after I'm sure
> #primitiveFileAtEnd works properly.
This would have bay be acceptable on a major release. You /cannot/ break problems motives and expect image code to change except at a major release. The VM /must/ continue to run exist my images unchanged. If it does not then there has been a regression and it must be fixed. So if your changes to primitiveFileAtEnd are at fault they must be fixed.
Adding primitivePeek seems to me a mistake. It is adding unnecessary code at a low level. I had managed to get perk working for stdin. Why is it broken?
>
> Cheers,
> Alistair
>
>
>
>
>
>> I think the details are in the nextChunkNoTag method in the
>> CogTools-Listener package. I was trying to do the simplest thing that could
>> possibly work here, not produce a usable listener. The ! requirement is
>> absurd for general use but acceptable for someone simply wanting to exercise
>> (potentially non-blocking) reading from stdin.
>>
>>
>> _,,,^..^,,,_
>> best, Eliot
>>
>>
>>
>
More information about the Squeak-dev
mailing list
|