Use `open-pipe*` instead of `system`

This commit is contained in:
contrapunctus 2020-11-29 10:46:45 +05:30
parent ab1490d840
commit efde6c9003
1 changed files with 7 additions and 2 deletions

9
mkly
View File

@ -4,7 +4,8 @@
(ice-9 match)
(srfi srfi-1)
(ice-9 format)
(ice-9 regex))
(ice-9 regex)
(ice-9 popen))
;; If ARG is truthy, return "-<ARG>", else return "".
(define (file-name-part arg)
@ -13,7 +14,11 @@
;; Return the current branch of the project's version control system.
(define (vcs-current-branch)
(cond ((file-exists? ".git")
(system "git rev-parse --abbrev-ref HEAD"))
(let* ((port (open-pipe* "open_read"
"git" "rev-parse" "--abbrev-ref" "HEAD"))
(output (read-line port)))
(close-pipe port)
output))
(else (error "Could not find a version control system"))))
(define (flatten seq)