dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 5df268066be5c04dffb27051a0abd0e8c328a751
Author: John Darrington <[email protected]>
Date: Thu Dec 29 19:18:52 2016 +0100
installer: Close unused ports in pipe-cmd.
* gnu/system/installer/utils.scm (pipe-cmd): Close all unused ports.
---
gnu/system/installer/utils.scm | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/gnu/system/installer/utils.scm b/gnu/system/installer/utils.scm
index 8623169..04f53ab 100644
--- a/gnu/system/installer/utils.scm
+++ b/gnu/system/installer/utils.scm
@@ -77,23 +77,22 @@
(define* (pipe-cmd ipipe cmd #:rest args)
"Run CMD ARGS ... sending stdout and stderr to IPIPE. Returns the exit
status of CMD."
- (let* (
- (pipep (pipe))
+ (let* ((pipep (pipe))
(pid (primitive-fork)))
-
(if (zero? pid)
(begin
+ (close-port (car pipep))
(redirect-port (cdr pipep) (current-output-port))
(redirect-port (cdr pipep) (current-error-port))
(apply execlp cmd args))
(begin
- (close (cdr pipep))
+ (close-port (cdr pipep))
(let loop ((c (read-char (car pipep))))
(unless (eof-object? c)
(display c ipipe)
(force-output ipipe)
- (loop (read-char (car pipep)))))))
-
+ (loop (read-char (car pipep)))))
+ (close-port (car pipep))))
(cdr (waitpid pid))))
(define (justify text width)