Re: Communicating with process

From: Erick Gallesio <>
Date: Thu, 30 May 1996 09:31:04 +0100

> TOKUNAGA Takenobu writes
> I want to run a process from STk and to communicate with it through
> the pipe.
> The following code seems to work well, but this actually does not work.
> (define cat-proc (run-process "cat" :input :pipe :output :pipe))
> (display "afo" (process-input cat-proc))
> (flush (process-input cat-proc))
> (read (process-output cat-proc))
> Evaluating (read ...) is blocked and I get nothing.

The problem comes from cat which keep the characters in its own buffer.
For some reason, using "cat -u" don't help here (at least on sunos4).
A possible solution, consists to put explicitly a nul character at the end of
the sting you write (a EOT should work also).
The following works on sunos (and should work on any POSIX system)

        (define cat-proc (run-process "cat" :input :pipe :output :pipe))
        (display "afo\000" (process-input cat-proc))
        (flush (process-input cat-proc))
        (read (process-output cat-proc))

Far from the beauty of Scheme ;-)

                -- Erick
Received on Thu May 30 1996 - 09:31:04 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST