diff options
author | Christopher Baines <mail@cbaines.net> | 2022-06-25 18:14:07 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-06-25 18:17:50 +0100 |
commit | 6d3b8df5628c93863ebccd6651039f2961059cee (patch) | |
tree | a8f06628809f158112a9afce1991172cb63949b3 | |
parent | 4772c03ffee551f872a952454ba7beace6f4c513 (diff) | |
download | guix-fix-open-inferior-error-port.tar guix-fix-open-inferior-error-port.tar.gz |
guix: inferior: Fix the behaviour of open-inferior #:error-port.fix-open-inferior-error-port
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.
-rw-r--r-- | guix/inferior.scm | 8 |
1 files 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 @@ custom binary port)." (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)))) |