guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A capture-stdout wrapper procedure in (guix build utils)?


From: Fabio Natali
Subject: A capture-stdout wrapper procedure in (guix build utils)?
Date: Sat, 20 Apr 2024 23:26:04 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]