pipes.scm added by gahr on Wed May 29 08:36:48 2024
(import (scheme) (chicken base) (chicken file posix) (chicken process)) (let-values (((p c ) (create-pipe))) (define (child) (let ((out (open-output-file* c)) (in (open-input-file* c))) (let ((r (read in))) (print "child: got " r) (write "pong" out) (flush-output out) ))) (let ((pid (process-fork child #t))) (if (eq? pid 0) (exit) (begin (let ((out (open-output-file* p)) (in (open-input-file* p))) (write "ping" out) (flush-output out) (let ((r (read in))) (print "parent: got " r)))))))