;;;; pty-test.scm (use test) (use pty) (test-begin "pty") (test-error (call-with-pty-process-io "foo" 'foo)) ;** PROBLEM ** ;Port out appears echoed to in ;Repeat runs have caused system crash on MacOS 10.4 ;Repeat runs have caused process pend on MacOS 10.4 ;Must be using 'bc' wrong ;; (test 3.1415926532 ;; (call-with-pty-process-io ;; '("/usr/bin/bc" "-lqi") ;; (lambda (in out pid) ;; ;;operation ;; (display "scale=10; 4*a(1)" out) (newline out) ;; ;;result ;; (let ((res (read in))) ;; ;; clean termination ;; (display "quit\n" out) ;; res)))) (test '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048") (call-with-pty-process-io '("/usr/bin/units" "-q") (lambda (in out pid) ;; operation (display "meters" out) (newline out) (display "feet" out) (newline out) ;; result (let ((res (list (read-line in) (read-line in) (read-line in) (read-line in)))) ;; clean termination - send EOT (display (integer->char 4) out) res)))) (test-end)