This is so similar in concept to what I'm doing with named pipes that I figured I ought to share it now:
First of all, you can create a named pipe in a directory with the command "mkfifo name".
Then, I have a shell script in mzscheme (should probably update to Racket soon) for launching arc that sets up the long running process with normal output redirected to a log file and a second repl redirected to two named pipes "in" and "out". The important part is
which could be written either in arc or Racket. In arc, it would probably be:
(w/stdin (infile "in")
(w/stdout (outfile "out")
($:tl))) ;whatever method you use to get to racket and call the repl
I'm not sure if that would work as well, since as far as I know there is no method in arc for setting the filestream buffer mode to 'none. If you have any issues, just use the racket version above.
Anyway, once you have the pipes set up, you can echo and cat them like any other file. The main difference being that they are treated exactly like a normal repl, and shouldn't have the overhead of sleeping and reading/erasing a file. I use a shell script to connect to them as a repl most of the time: