all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Lechner via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org>
To: Fabio Natali <me@fabionatali.com>, guix-devel@gnu.org
Subject: Re: A capture-stdout wrapper procedure in (guix build utils)?
Date: Sun, 21 Apr 2024 08:35:04 -0700	[thread overview]
Message-ID: <871q6y685z.fsf@lease-up.com> (raw)
In-Reply-To: <87wmorr7r7.fsf@fabionatali.com>

Hi Fabio,

On Sat, Apr 20 2024, Fabio Natali wrote:

> do you think it might be worth to add it (or a variation thereof) to
> '(guix build utils)'?

I use this [1] which gives the caller access to the exit status and is
also slightly shorter:

    (define (command-with-output-to-string/status* command)
      (let* ((input-pipe (apply open-pipe* OPEN_READ command))
    	 (output (get-string-all input-pipe))
    	 (exit-val (status:exit-val (close-pipe input-pipe))))
        (values output exit-val)))

It may be better, however, to finally fix Guile's 'system' and 'system*'
to work with 'with-output-to-string'. [2]

Kind regards
Felix

[1] https://codeberg.org/lechner/preambled-exec/src/commit/c5c498c3890f22cda070fe35b314f01982ebc885/test/simple-variable.scm#L28-L32
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43364


  reply	other threads:[~2024-04-21 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20 22:26 A capture-stdout wrapper procedure in (guix build utils)? Fabio Natali
2024-04-21 15:35 ` Felix Lechner via Development of GNU Guix and the GNU System distribution. [this message]
2024-04-23 15:38   ` Fabio Natali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q6y685z.fsf@lease-up.com \
    --to=guix-devel@gnu.org \
    --cc=felix.lechner@lease-up.com \
    --cc=me@fabionatali.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.