[racket] A strange DrRacket interaction

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu Feb 7 16:56:54 EST 2013

Hi All,

I have a case where a program doesn't behave the same
way in DrRacket and in command line racket. In DrRacket
I get an error from   collects/racket/private/port.rkt:128:15:

   write-bytes-avail: output port is closed

I am basically calling (system* "fpctest") where
fpctest is the result of compiling this program with fpc:

program fpctest;
var s:string;
begin
  writeln('Enter string:');
  readln(s);
  writeln(s);
  writeln('hello');
end.

The interaction in DrRacket is:

1. Input box appears
2. I enter   abcdef
3. abcdef appears where the input box was displayed.
4. This error messages is displayed:
        .../Racket v5.3.2/collects/racket/private/port.rkt:128:15:
         write-bytes-avail: output port is closed
5. The following is displayed:
    Enter string:
    bcdef
    hello

There are three things of interest:
  1. The input box appears before "Enter string" is
       written to the screen.
     (Is this the Pascal program misbehaving?)
2. The error that points to a private file, which
    seems odd.
3. The a is missing from the output of the
     Pascal program.

Running the program from command line racket
seems to work every time.

Once in while (say 1 out of 10 times) it works in DrRacket too.

Any ideas what can explain what I see?

Images: http://imgur.com/wSE6De5
              http://imgur.com/hdYJcKx

--
Jens Axel Søgaard


Posted on the users mailing list.