[PATCH 0/2] Support customising the inferior error port

DoneSubmitted by Christopher Baines.
Details
2 participants
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Severity
normal
C
C
Christopher Baines wrote on 2 Oct 2019 20:20
(address . guix-patches@gnu.org)
87bluzovp5.fsf@cbaines.net
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(-)
-----BEGIN PGP SIGNATURE-----
iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl2U6oZfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNFODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE9XdBFxAAs142eepdsADxvHrDlb6BIMXf4ZRVVArc8nHyvMJBAgbk89Jw5NW/D1rOGePsobXmF8DpyZ/fSC+Kqv6aNUjHjoBDjBLV3vF00DFrNbZMCNVwQ2jMwtaOZQw5/HanmOt25GeMHdQkAv06I1mjLbxR1mof5Ff2X+/BfJth6+Ja/xl7uqhPUn3/4OnfV4973lL4KYt0pPuGVtvpn+Qt2oJteUcmvIFPwiKI9P1qfu8o0wi/2Bwiuygg7TBn/WI9bh+qE/aYI59YJFtrH+dugAbQrQr3xwAkAepkfEJUc1HaywUuc7XGqUeZFXE9mqVCxu2mu5QXY9JT/A8gvapyB9KVIjk1jo23uwAcjjyWJemtSnH92xTkl3Vi0Au5iVzbj19t8fprcb4qdQQ4vjJhIDRMe9a1fmwJVlzqUB+KyMmu7NU+Xjm2LMnehc6386iJUuzSkMkBXuXzCT6XEGwsdmSCWfimZKKFApY7Kv8a5YPAcEkARZt+vF0dGrEJbQ4WAaue1x0eI81nmaoXoa0TpKmkPci4cM9Q58HCQ3Td6mXOt60zmzRNV7wKod783hwnuvW/ODUpoivRoZj/mp31p3YVoMMDFCZX0o7FIJnUTAH40zliGZ0yckfBZIkLmSQHrkg/3M9D821+FtNYJzlyZQWiy4cMwSnBKYVZE6sCGrxDg1o==Wvjx-----END PGP SIGNATURE-----
C
C
Christopher Baines wrote on 2 Oct 2019 20:28
[PATCH 1/2] inferior: Allow controlling the inferior error port.
(address . 37587@debbugs.gnu.org)
20191002182816.14051-1-mail@cbaines.net
Previously, stderr for the inferior process would always be sent to /dev/nullbecause the current-output-port when the process is launched is a voidport. 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 defaultof (%make-void-port "w").--- guix/inferior.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Toggle diff (36 lines)diff --git a/guix/inferior.scm b/guix/inferior.scmindex 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
C
C
Christopher Baines wrote on 2 Oct 2019 20:28
[PATCH 2/2] inferior: Set the error port when using older Guix versions.
(address . 37587@debbugs.gnu.org)
20191002182816.14051-2-mail@cbaines.net
This makes the behaviour more consistent.
* guix/inferior.scm (inferior-pipe): Wrap the second open-pipe* call withwith-error-to-port, to match the first call to open-pipe*.--- guix/inferior.scm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
Toggle diff (41 lines)diff --git a/guix/inferior.scm b/guix/inferior.scmindex 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
L
L
Ludovic Courtès wrote on 14 Oct 2019 00:04
Re: [bug#37587] [PATCH 0/2] Support customising the inferior error port
(name . Christopher Baines)(address . mail@cbaines.net)(address . 37587@debbugs.gnu.org)
87wod8715v.fsf@gnu.org
Hi Chris,
Christopher Baines <mail@cbaines.net> skribis:
Toggle quote (4 lines)> 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’.
C
C
Christopher Baines wrote on 15 Oct 2019 20:03
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 37587-done@debbugs.gnu.org)
87y2xlrinb.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (12 lines)> 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!
Great, I've pushed these as ef0c265438149691d980ce17f0c5aaea5e8f6b77.
Thanks for taking a look :)
-----BEGIN PGP SIGNATURE-----
iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl2mCdhfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNFODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE9Xe97Q/7BkLzNY6/R+sfY3rB7nGKkG7pjNJ+tnuBpvONdvMJTndL1/4SGJlALaEOpG7vWbJpmGNbELrqSgf554Rr8bvtsUgvBCKxUmiabWajZ2webXwV4nIJjlXUIOBs1dNzWJgadD29xofDIsJn5XHuVB2+wG9PhSjRfHW1z7trs0+/xES0dPEaR5tw11VbND8ZXhGuwIziHVF5QJuVz3Rf6bZesiAAT8+Abw8ojLeFvNZ/nvpgLnzVtrimUKSHC6xFYXalCOQyZYRQehs5L+cMf0oNcHc2UfjKZjxwz0UFJ4bcQohcGcOxd3eGsXtW2VtLFMQyElSDIfRIAThodzEanYEio1H/5Tux/gc61xZc/mtlIfWxozWtioWba65RX4r6DIAAv6T3bdAVVIO0bMzQmKiL+mB47F76KE5UGdlquFCwHFm79jo138D/8ZHpifA3t65LoGKl/0uIW1fao4lPBgHMfejLAfp+SGd7BQbmZf9dHTmxxrFJizyg/7rmVh9ekGEo+HoW3VNKzkBrgUuwCmkQwnqwAhU/V8oha3fZCtG64FKA39iW8v7HyhHrdyNjHD3GtVP64G/JkHhVQkity/kFIcuRc8FnYN59MsEcYIDXvx6jxIp2hnik2TEEz0s66wQ2Sm63AUdB7lXOeyjgkk/7MY1O5pFgt2JXkpcREeUKbXs==6GEE-----END PGP SIGNATURE-----
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 37587@debbugs.gnu.org