This is a nice idea. The way Racket does it is to make
with-output-to-string cooperate with system:
(with-output-to-string (lambda () (system "date")))
but a quick check shows that Guile does not yet have such cooperation in
place. Would that be a good place to start looking?
Tony
On 23/04/2024 18:32, Fabio Natali wrote:
Dear All 👋,
I've been encountering a few times the need for a procedure like
'system' or 'system*' but that might be capable of capturing the output
of the program that's being called.
While this is something that can be solved with a simple 'open-pipe*'
wrapper, the pattern seems relatively frequent in Guix, which is where I
noticed it. I suggested that some variant of such a wrapper could be
added to '(guix build utils)'⁰.
In reply to my post, it was brought to my attention that the problem
might be addressed at the Guile level and pointed me to this bug report.
I thought of sending a quick follow-up here to see if there's any rough
consensus on a possible way of addressing this - or why it might be
difficult or potentially not worth the effort.
Thanks, all best, Fabio.
⁰ https://lists.gnu.org/archive/html/guix-devel/2024-04/msg00199.html