* [bug#37587] [PATCH 0/2] Support customising the inferior error port
@ 2019-10-02 18:20 Christopher Baines
2019-10-02 18:28 ` [bug#37587] [PATCH 1/2] inferior: Allow controlling " Christopher Baines
2019-10-13 22:04 ` [bug#37587] [PATCH 0/2] Support customising the inferior error port Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Christopher Baines @ 2019-10-02 18:20 UTC (permalink / raw)
To: 37587
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
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(-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#37587] [PATCH 1/2] inferior: Allow controlling the inferior error port.
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
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
1 sibling, 1 reply; 5+ messages in thread
From: Christopher Baines @ 2019-10-02 18:28 UTC (permalink / raw)
To: 37587
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#37587] [PATCH 2/2] inferior: Set the error port when using older Guix versions.
2019-10-02 18:28 ` [bug#37587] [PATCH 1/2] inferior: Allow controlling " Christopher Baines
@ 2019-10-02 18:28 ` Christopher Baines
0 siblings, 0 replies; 5+ messages in thread
From: Christopher Baines @ 2019-10-02 18:28 UTC (permalink / raw)
To: 37587
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#37587] [PATCH 0/2] Support customising the inferior error port
2019-10-02 18:20 [bug#37587] [PATCH 0/2] Support customising the inferior error port Christopher Baines
2019-10-02 18:28 ` [bug#37587] [PATCH 1/2] inferior: Allow controlling " Christopher Baines
@ 2019-10-13 22:04 ` Ludovic Courtès
2019-10-15 18:03 ` bug#37587: " Christopher Baines
1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2019-10-13 22:04 UTC (permalink / raw)
To: Christopher Baines; +Cc: 37587
Hi Chris,
Christopher Baines <mail@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’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-15 18:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 18:20 [bug#37587] [PATCH 0/2] Support customising the inferior error port Christopher Baines
2019-10-02 18:28 ` [bug#37587] [PATCH 1/2] inferior: Allow controlling " Christopher Baines
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
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).