;; count the number of cat processes (define (count-child-processes) (print "\n" (with-input-from-pipe "pstree -p|egrep 'cat\\(' | wc" read))) (count-child-processes) (receive (pip pop pid) (process "cat" '()) (display "hello\n" pop) (print "read: " (read-line pip)) (process-signal pid signal/term) (print "done")) ;; cat process is incremented (process-signal didn't work), why? (count-child-processes) ;; we can kill process with close-*-port: (define (tiger-dance) (receive (pip pop pid) (process "cat" '()) (display "hello\n" pop) (print "read: " (read-line pip)) (close-input-port pip) (close-output-port pop) (print "done"))) (tiger-dance) (count-child-processes) ;; but that causes strange 'bugs' like hangs: (repeat 3 (thread-start! tiger-dance))