[plt-scheme] no #!eof
Matthew Flatt wrote at 04/15/2008 07:51 AM:
> At Tue, 15 Apr 2008 03:38:07 -0400, Neil Van Dyke wrote:
>
>> Incidentally, in some experimenting just now, it seems the "sync" of PLT
>> 372 and 3.99.0.16 has the expected blocking behavior on a FIFO up until
>> the first EOF, but subsequently does not block on the FIFO. If multiple
>> input segments are supported, should this EOF behavior in "sync" be changed?
>>
>
> I'm not suite sure what you mean. Can you provide an example?
If I do these three things:
1. Shell command: mkfifo /tmp/my-fifo
2. Start this in MzScheme 372:
(let ((in (open-input-file "/tmp/my-fifo")))
(let loop ()
(sync in)
(printf "hit ~S\n" (read-byte in))
(loop)))
3. Shell command: echo 123 > /tmp/my-fifo
Then the output from the MzScheme process will be:
hit 49
hit 50
hit 51
hit 10
hit #<eof>
hit #<eof>
hit #<eof>
hit #<eof>
hit #<eof>
hit #<eof>
[...]
Given the discussion yesterday, I'd expect "sync" to block after
printing the first "hit #<eof>", until I wrote more input to the FIFO,
but it no longer blocks after the first EOF.
I also see the same behavior when using "cat" to write incrementally to
the FIFO -- "sync" blocks as expected, until "cat" exits, then "sync" no
longer blocks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080416/da4f41b5/attachment.html>