stdin processing for run-git
This commit is contained in:
@@ -88,11 +88,13 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; goal : Run Git without allowing interactive terminal prompts.
|
||||
; pre : args contains the Git command and its arguments.
|
||||
; post : Standard output and error have been read completely.
|
||||
; pre : args contains the Git command and its arguments; input is #f or a string
|
||||
; that must be written to Git's standard input.
|
||||
; post : Optional input has been written and standard output and error have been
|
||||
; read completely.
|
||||
; result : The exit code and ordered (source line) output items.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(define (run-git args)
|
||||
(define (run-git args #:input (input #f))
|
||||
(putenv "GIT_TERMINAL_PROMPT" "0")
|
||||
(let-values (((process stdout stdin stderr)
|
||||
(apply subprocess
|
||||
@@ -102,6 +104,9 @@
|
||||
(git-exe)
|
||||
(map (λ (arg) (format "~a" arg)) args)
|
||||
)))
|
||||
(when input
|
||||
(display input stdin)
|
||||
(flush-output stdin))
|
||||
(close-output-port stdin)
|
||||
(let ((output-channel (make-channel)))
|
||||
(define (read-output source port)
|
||||
|
||||
Reference in New Issue
Block a user