GNU bug report logs - #37587
[PATCH 0/2] Support customising the inferior error port

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Wed, 2 Oct 2019 18:22:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37587 in the body.
You can then email your comments to 37587 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37587; Package guix-patches. (Wed, 02 Oct 2019 18:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 02 Oct 2019 18:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/2] Support customising the inferior error port
Date: Wed, 02 Oct 2019 19:20:54 +0100
[Message part 1 (text/plain, inline)]
Christopher Baines (2):
  inferior: Allow controlling the inferior error port.
  inferior: Set the error port when using older Guix versions.

 guix/inferior.scm | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#37587; Package guix-patches. (Wed, 02 Oct 2019 18:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 37587 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 37587 <at> debbugs.gnu.org
Subject: [PATCH 1/2] inferior: Allow controlling the inferior error port.
Date: Wed,  2 Oct 2019 19:28:15 +0100
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





Information forwarded to guix-patches <at> gnu.org:
bug#37587; Package guix-patches. (Wed, 02 Oct 2019 18:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 37587 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 37587 <at> debbugs.gnu.org
Subject: [PATCH 2/2] inferior: Set the error port when using older Guix
 versions.
Date: Wed,  2 Oct 2019 19:28:16 +0100
This makes the behaviour more consistent.

* guix/inferior.scm (inferior-pipe): Wrap the second open-pipe* call with
with-error-to-port, to match the first call to open-pipe*.
---
 guix/inferior.scm | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index eecdbdd5ca..b8e2f21f42 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -125,19 +125,21 @@ it's an old Guix."
 
           ;; Older versions of Guix didn't have a 'guix repl' command, so
           ;; emulate it.
-          (open-pipe* OPEN_BOTH "guile"
-                      "-L" (string-append directory "/share/guile/site/"
-                                          (effective-version))
-                      "-C" (string-append directory "/share/guile/site/"
-                                          (effective-version))
-                      "-C" (string-append directory "/lib/guile/"
-                                          (effective-version) "/site-ccache")
-                      "-c"
-                      (object->string
-                       `(begin
-                          (primitive-load ,(search-path %load-path
-                                                        "guix/repl.scm"))
-                          ((@ (guix repl) machine-repl))))))
+          (with-error-to-port error-port
+            (lambda ()
+              (open-pipe* OPEN_BOTH "guile"
+                          "-L" (string-append directory "/share/guile/site/"
+                                              (effective-version))
+                          "-C" (string-append directory "/share/guile/site/"
+                                              (effective-version))
+                          "-C" (string-append directory "/lib/guile/"
+                                              (effective-version) "/site-ccache")
+                          "-c"
+                          (object->string
+                           `(begin
+                              (primitive-load ,(search-path %load-path
+                                                            "guix/repl.scm"))
+                              ((@ (guix repl) machine-repl))))))))
         pipe)))
 
 (define* (port->inferior pipe #:optional (close close-port))
-- 
2.23.0





Information forwarded to guix-patches <at> gnu.org:
bug#37587; Package guix-patches. (Sun, 13 Oct 2019 22:05:02 GMT) Full text and rfc822 format available.

Message #14 received at 37587 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 37587 <at> debbugs.gnu.org
Subject: Re: [bug#37587] [PATCH 0/2] Support customising the inferior error
 port
Date: Mon, 14 Oct 2019 00:04:12 +0200
Hi Chris,

Christopher Baines <mail <at> cbaines.net> skribis:

> Christopher Baines (2):
>   inferior: Allow controlling the inferior error port.
>   inferior: Set the error port when using older Guix versions.

Both patches LGTM.

Thank you, and sorry for the delay!

Ludo’.




Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Tue, 15 Oct 2019 18:04:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Tue, 15 Oct 2019 18:04:02 GMT) Full text and rfc822 format available.

Message #19 received at 37587-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 37587-done <at> debbugs.gnu.org
Subject: Re: [bug#37587] [PATCH 0/2] Support customising the inferior error
 port
Date: Tue, 15 Oct 2019 19:03:04 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Chris,
>
> Christopher Baines <mail <at> cbaines.net> skribis:
>
>> Christopher Baines (2):
>>   inferior: Allow controlling the inferior error port.
>>   inferior: Set the error port when using older Guix versions.
>
> Both patches LGTM.
>
> Thank you, and sorry for the delay!

Great, I've pushed these as ef0c265438149691d980ce17f0c5aaea5e8f6b77.

Thanks for taking a look :)
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Nov 2019 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.