Support call-process-to-string

Writes an Elisp macro to use `call-process` (because it's fast) but capture the
output to a string.
This commit is contained in:
William Carroll 2020-01-16 01:12:35 +00:00
parent 34c9d74335
commit 438ff66eed

View file

@ -44,6 +44,12 @@
(apply #'string/concat)
message))
(defmacro prelude/call-process-to-string (cmd &rest args)
"Return the string output of CMD called with ARGS."
`(with-temp-buffer
(call-process ,cmd nil (current-buffer) nil ,@args)
(buffer-string)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Assertions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;