>>>>> "sk" == stktrc <firstname.lastname@example.org> writes:
sk> The following procedure forks a child and returns ports on the childs
sk> stdin and stdout. It would be interesting to hear if there are other,
sk> perhaps more standard, solutions to this.
I have used the following code in the past, which is an analogue of
the "open2" function in Perl.
(define (open2 cmd)
(receive (child-read parent-write) (pipe)
(receive (parent-read child-write) (pipe)
(cond ((fork) ; parent process
(else ; child process
(move->fdes child-read 0)
(move->fdes child-write 1)
(lambda () (run ,((infix-splitter " ") cmd))))))
(values parent-read parent-write))))
Eric Marsden <URL:http://www.laas.fr/~emarsden/>