(module proc-utils mzscheme (require (lib "port.ss")) (provide with-input-from-subprocess) (define (with-input-from-subprocess thunk exe . args) (let-values ([(in out) (make-pipe)] [(p pout pin perr) (apply subprocess #f (open-input-file "/dev/null") #f exe args)]) (thread (λ () (copy-port pout out) (close-output-port out) (subprocess-wait p))) (parameterize ([current-input-port in]) (begin0 (thunk) (subprocess-wait p))))))