<div dir="ltr">text:ports (in the framework) is where the implementation of DrRacket's port is if that helps.<div><br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 9:08 AM, Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net" target="_blank">jensaxel@soegaard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/2/7 Jens Axel Søgaard <<a href="mailto:jensaxel@soegaard.net">jensaxel@soegaard.net</a>>:<br>
<br>
This is an update:<br>
<br>
1. Danny confirms that the bug is repeatable on his machine.<br>
<br>
2. Weirdness on first character of the input reminded him<br>
on this bug:<br>
<a href="http://comments.gmane.org/gmane.comp.lang.racket.user/1759" target="_blank">http://comments.gmane.org/gmane.comp.lang.racket.user/1759</a><br>
<br>
3. Wrapping the call to system* with<br>
(parameterize ([current-input-port (open-input-bytes #"abcde\n") …)<br>
make the program works expected.<br>
<br>
The last point imply that the behaviour has something to do with the<br>
"buffer ports" that DrRackets sets up to convert from ports used<br>
in DrRacket to the file-stream-port need by system*.<br>
<br>
4. The equivalent C program (see below) does not trigger the error.<br>
<br>
#include <stdio.h><br>
int main(int argc, char **argv) {<br>
char str[200];<br>
printf("Enter string:\n");<br>
fgets(str, 200, stdin);<br>
printf("%s\n",str);<br>
return 0;<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
/Jens Axel<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> I am basically calling (system* "fpctest") where<br>
> fpctest is the result of compiling this program with fpc:<br>
><br>
> program fpctest;<br>
> var s:string;<br>
> begin<br>
> writeln('Enter string:');<br>
> readln(s);<br>
> writeln(s);<br>
> writeln('hello');<br>
> end.<br>
><br>
> The interaction in DrRacket is:<br>
><br>
> 1. Input box appears<br>
> 2. I enter abcdef<br>
> 3. abcdef appears where the input box was displayed.<br>
> 4. This error messages is displayed:<br>
> .../Racket v5.3.2/collects/racket/private/port.rkt:128:15:<br>
> write-bytes-avail: output port is closed<br>
> 5. The following is displayed:<br>
> Enter string:<br>
> bcdef<br>
> hello<br>
><br>
> There are three things of interest:<br>
> 1. The input box appears before "Enter string" is<br>
> written to the screen.<br>
> (Is this the Pascal program misbehaving?)<br>
> 2. The error that points to a private file, which<br>
> seems odd.<br>
> 3. The a is missing from the output of the<br>
> Pascal program.<br>
><br>
> Running the program from command line racket<br>
> seems to work every time.<br>
><br>
> Once in while (say 1 out of 10 times) it works in DrRacket too.<br>
><br>
> Any ideas what can explain what I see?<br>
><br>
> Images: <a href="http://imgur.com/wSE6De5" target="_blank">http://imgur.com/wSE6De5</a><br>
> <a href="http://imgur.com/hdYJcKx" target="_blank">http://imgur.com/hdYJcKx</a><br>
<br>
</div></div><div class="HOEnZb"><div class="h5">____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div>