(require-extension posix srfi-4) (receive (in out) (create-pipe) (receive (pid ok? status) (process-wait (process-fork (lambda () (file-close in) (with-output-to-port (open-output-file* out) (lambda () (display "hello, world\n") (exit 0)))))) (file-close out) (read-lines (open-input-file* in)))) ;; NOTE The following don't need to run, but do need to be read by csi ;; in order to trigger the error (hence the datum comments). Fun, huh? #;(define-syntax check (syntax-rules () ((_ expr) (condition-case expr ((exn i/o file) 'ok))))) #;(with-output-to-file "empty-file" void) #;(call-with-output-file "empty-file" (lambda (out) (close-output-port out) (check (write '(foo) out)) (check (fprintf out "blabla")) (check (begin (print-call-chain out) (void))) (check (print-error-message (make-property-condition 'exn 'message "foo") out)) (check (with-output-to-port out (lambda () (print "foo")))) (check (with-output-to-port out (lambda () (print* "foo")))) (check (display "foo" out)) (check (newline out))))