(define (run-git repo command args proc) (receive (in out pid err) (process* "git" (cons* "--git-dir" repo command args)) (begin0 (proc in) (receive (_ ok? status/signal) (process-wait pid) (unless ok? (error 'run-git (sprintf "git ~A on ~A terminated abnormally with signal ~A" command repo status/signal))) (unless (zero? status/signal) (error 'run-git (sprintf "git ~A on ~A failed with exit status ~A:~%~A" command repo status/signal (read-all err))))) (close-input-port err) (close-input-port in) (close-output-port out))))