all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#56218] [PATCH] guix: inferior: Fix the behaviour of open-inferior #:error-port.
@ 2022-06-25 17:18 Christopher Baines
  2022-06-25 17:50 ` Maxime Devos
  2022-06-26 15:46 ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Christopher Baines @ 2022-06-25 17:18 UTC (permalink / raw)
  To: 56218

This should be the error port used by the inferior process, but currently it's
either stderr if #:error-port is a file port, or /dev/null otherwise.

I'm looking at this as the Guix Data Service uses this behaviour to record and
display logs from inferior processes.

* guix/inferior.scm (open-bidirectional-pipe): Call dup2 for file descriptor
2, passing either the file number for the current error port, or a file
descriptor for /dev/null.
---
 guix/inferior.scm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 54200b75e4..e36806ac84 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -156,12 +156,14 @@ (define (open-bidirectional-pipe command . args)
             (close-port parent)
             (close-fdes 0)
             (close-fdes 1)
+            (close-fdes 2)
             (dup2 (fileno child) 0)
             (dup2 (fileno child) 1)
             ;; Mimic 'open-pipe*'.
-            (unless (file-port? (current-error-port))
-              (close-fdes 2)
-              (dup2 (open-fdes "/dev/null" O_WRONLY) 2))
+            (dup2 (if (file-port? (current-error-port))
+                      (fileno (current-error-port))
+                      (open-fdes "/dev/null" O_WRONLY))
+                  2)
             (apply execlp command command args))
           (lambda ()
             (primitive-_exit 127))))
-- 
2.36.1





^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-08 12:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25 17:18 [bug#56218] [PATCH] guix: inferior: Fix the behaviour of open-inferior #:error-port Christopher Baines
2022-06-25 17:50 ` Maxime Devos
2022-06-25 20:59   ` Maxime Devos
2022-06-27 11:37   ` Christopher Baines
2022-06-26 15:46 ` Ludovic Courtès
2022-06-27 11:39   ` Christopher Baines
2022-07-05 15:12     ` Ludovic Courtès
2022-07-08 12:54       ` bug#56218: " Christopher Baines

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.