From: Christopher Baines <mail@cbaines.net>
To: 37587@debbugs.gnu.org
Subject: [bug#37587] [PATCH 1/2] inferior: Allow controlling the inferior error port.
Date: Wed, 2 Oct 2019 19:28:15 +0100 [thread overview]
Message-ID: <20191002182816.14051-1-mail@cbaines.net> (raw)
In-Reply-To: <87bluzovp5.fsf@cbaines.net>
Previously, stderr for the inferior process would always be sent to /dev/null
because the current-output-port when the process is launched is a void
port. This change means that it's possible to pass in a different port to use.
* guix/inferior.scm (inferior-pipe): Take the error-port as an argument.
(open-inferior): Add new error-port keyword argument, with a default
of (%make-void-port "w").
---
guix/inferior.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/guix/inferior.scm b/guix/inferior.scm
index d6d2053ab8..eecdbdd5ca 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -110,11 +110,11 @@
(packages inferior-package-promise) ;promise of inferior packages
(table inferior-package-table)) ;promise of vhash
-(define (inferior-pipe directory command)
+(define* (inferior-pipe directory command error-port)
"Return an input/output pipe on the Guix instance in DIRECTORY. This runs
'DIRECTORY/COMMAND repl' if it exists, or falls back to some other method if
it's an old Guix."
- (let ((pipe (with-error-to-port (%make-void-port "w")
+ (let ((pipe (with-error-to-port error-port
(lambda ()
(open-pipe* OPEN_BOTH
(string-append directory "/" command)
@@ -161,11 +161,13 @@ inferior."
(_
#f)))
-(define* (open-inferior directory #:key (command "bin/guix"))
+(define* (open-inferior directory
+ #:key (command "bin/guix")
+ (error-port (%make-void-port "w")))
"Open the inferior Guix in DIRECTORY, running 'DIRECTORY/COMMAND repl' or
equivalent. Return #f if the inferior could not be launched."
(define pipe
- (inferior-pipe directory command))
+ (inferior-pipe directory command error-port))
(port->inferior pipe close-pipe))
--
2.23.0
next prev parent reply other threads:[~2019-10-02 18:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 18:20 [bug#37587] [PATCH 0/2] Support customising the inferior error port Christopher Baines
2019-10-02 18:28 ` Christopher Baines [this message]
2019-10-02 18:28 ` [bug#37587] [PATCH 2/2] inferior: Set the error port when using older Guix versions Christopher Baines
2019-10-13 22:04 ` [bug#37587] [PATCH 0/2] Support customising the inferior error port Ludovic Courtès
2019-10-15 18:03 ` bug#37587: " Christopher Baines
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191002182816.14051-1-mail@cbaines.net \
--to=mail@cbaines.net \
--cc=37587@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).