Hallo,

I noticed this capture-stdout wrapper procedure while reviewing Tomas'
patch 68289⁰:

,----
| (define (capture-stdout . prog+args)
|   (let* ((port (apply open-pipe* OPEN_READ prog+args))
|          (data (get-string-all port)))
|     (if (= 0 (status:exit-val (close-pipe port)))
|         (string-trim-right data #\newline)
|         (error "command failed"))))
`----

Since this seems to be a somewhat general and useful pattern, do you
think it might be worth to add it (or a variation thereof) to '(guix
build utils)'?

Thanks, best wishes, Fabio.


⁰ https://issues.guix.gnu.org/issue/68289/#0-lineno93


-- 
Fabio Natali
https://fabionatali.com

  • A capture-stdout ... Fabio Natali

Reply via email to